Ejemplo n.º 1
0
 /** {@inheritDoc} */
 public boolean containsAll(TLongCollection collection) {
   TLongIterator iter = collection.iterator();
   while (iter.hasNext()) {
     if (!TLongLongHashMap.this.containsValue(iter.next())) {
       return false;
     }
   }
   return true;
 }
Ejemplo n.º 2
0
 /** {@inheritDoc} */
 @SuppressWarnings({"SuspiciousMethodCalls"})
 public boolean retainAll(Collection<?> collection) {
   boolean modified = false;
   TLongIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(Long.valueOf(iter.next()))) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
Ejemplo n.º 3
0
 /** {@inheritDoc} */
 public boolean retainAll(TLongCollection collection) {
   if (this == collection) {
     return false;
   }
   boolean modified = false;
   TLongIterator iter = iterator();
   while (iter.hasNext()) {
     if (!collection.contains(iter.next())) {
       iter.remove();
       modified = true;
     }
   }
   return modified;
 }
Ejemplo n.º 4
0
 /** {@inheritDoc} */
 public boolean removeAll(TLongCollection collection) {
   if (this == collection) {
     clear();
     return true;
   }
   boolean changed = false;
   TLongIterator iter = collection.iterator();
   while (iter.hasNext()) {
     long element = iter.next();
     if (remove(element)) {
       changed = true;
     }
   }
   return changed;
 }
Ejemplo n.º 5
0
  public boolean unload100OldestChunks() {
    int var1;
    // Spout Start
    TLongIterator iterator = this.droppedChunksSet.iterator();
    for (var1 = 0; var1 < 100 && iterator.hasNext(); ++var1) {
      long var2 = iterator.next();
      iterator.remove();
      Chunk var3 = (Chunk) this.chunkMap.func_35578_a(var2);
      var3.onChunkUnload();
      this.func_28062_b(var3);
      this.func_28063_a(var3);
      this.droppedChunksSet.remove(var2);
      this.chunkMap.func_35574_d(var2);
      this.chunkList.remove(var3);
    }
    // Spout End

    for (var1 = 0; var1 < 10; ++var1) {
      if (this.field_35392_h >= this.chunkList.size()) {
        this.field_35392_h = 0;
        break;
      }

      Chunk var4 = (Chunk) this.chunkList.get(this.field_35392_h++);
      EntityPlayer var5 =
          this.worldObj.getClosestPlayer(
              (double) (var4.xPosition << 4) + 8.0D,
              64.0D,
              (double) (var4.zPosition << 4) + 8.0D,
              288.0D);
      if (var5 == null) {
        this.func_35391_d(var4.xPosition, var4.zPosition);
      }
    }

    if (this.chunkLoader != null) {
      this.chunkLoader.func_814_a();
    }

    return this.chunkProvider.unload100OldestChunks();
  }
Ejemplo n.º 6
0
  TLongObjectHashMap<Value> solve() {
    while (!moving.empty()) {
      long id = moving.pop();
      Value value = solved.get(id);

      boolean stable = id > 0;
      long[] pIds = stable ? new long[] {id, -id} : new long[] {-id, id};
      Value[] pVals = stable ? new Value[] {value, value} : new Value[] {value, lattice.top};

      for (int i = 0; i < pIds.length; i++) {
        long pId = pIds[i];
        Value pVal = pVals[i];
        TLongHashSet dIds = dependencies.get(pId);
        if (dIds == null) {
          continue;
        }
        TLongIterator dIdsIterator = dIds.iterator();
        while (dIdsIterator.hasNext()) {
          long dId = dIdsIterator.next();
          IdPending pend = pending.remove(dId);
          if (pend != null) {
            IdResult pend1 = substitute(pend, pId, pVal);
            if (pend1 instanceof IdFinal) {
              IdFinal fi = (IdFinal) pend1;
              solved.put(dId, fi.value);
              moving.push(dId);
            } else {
              pending.put(dId, (IdPending) pend1);
            }
          }
        }
      }
    }
    pending.clear();
    return solved;
  }
Ejemplo n.º 7
0
  void doFlush(@NotNull DfaVariableValue varPlain, boolean markUnknown) {
    DfaVariableValue varNegated = varPlain.getNegatedValue();

    final int idPlain = varPlain.getID();
    final int idNegated = varNegated == null ? -1 : varNegated.getID();

    int[] classes = myIdToEqClassesIndices.get(idPlain);
    int[] negatedClasses = myIdToEqClassesIndices.get(idNegated);
    int[] result =
        ArrayUtil.mergeArrays(
            ObjectUtils.notNull(classes, ArrayUtil.EMPTY_INT_ARRAY),
            ObjectUtils.notNull(negatedClasses, ArrayUtil.EMPTY_INT_ARRAY));

    int interruptCount = 0;

    for (int varClassIndex : result) {
      EqClass varClass = myEqClasses.get(varClassIndex);
      if ((++interruptCount & 0xf) == 0) {
        ProgressManager.checkCanceled();
      }

      varClass = new EqClass(varClass);
      myEqClasses.set(varClassIndex, varClass);
      for (int id : varClass.toNativeArray()) {
        int idUnwrapped;
        if (id == idPlain
            || id == idNegated
            || (idUnwrapped = unwrap(myFactory.getValue(id)).getID()) == idPlain
            || idUnwrapped == idNegated) {
          varClass.removeValue(id);
        }
      }

      if (varClass.isEmpty()) {
        myEqClasses.set(varClassIndex, null);

        for (TLongIterator iterator = myDistinctClasses.iterator(); iterator.hasNext(); ) {
          long pair = iterator.next();
          if (low(pair) == varClassIndex || high(pair) == varClassIndex) {
            iterator.remove();
          }
        }
      } else if (varClass.containsConstantsOnly()) {
        for (TLongIterator iterator = myDistinctClasses.iterator(); iterator.hasNext(); ) {
          long pair = iterator.next();
          if (low(pair) == varClassIndex && myEqClasses.get(high(pair)).containsConstantsOnly()
              || high(pair) == varClassIndex
                  && myEqClasses.get(low(pair)).containsConstantsOnly()) {
            iterator.remove();
          }
        }
      }
    }

    removeAllFromMap(idPlain);
    removeAllFromMap(idNegated);
    myVariableStates.remove(varPlain);
    if (varNegated != null) {
      myVariableStates.remove(varNegated);
    }
    if (markUnknown) {
      myUnknownVariables.add(varPlain);
    }
    myCachedNonTrivialEqClasses = null;
    myCachedDistinctClassPairs = null;
    myCachedHash = null;
  }