@Override @SuppressWarnings("unchecked") public Iterator<E> iterator(E item) { if (firstItem == null || isEmpty()) { return (Iterator<E>) emptyIterator; } return new LinkIterator<E>(item); }
public void and(SharedBitSet other) { if (own) { value.and(other.value); } else { value = BitVector.and(value, other.value); own = true; } canonicalize(); }
public boolean orAndAndNot(SharedBitSet orset, SharedBitSet andset, SharedBitSet andnotset) { acquire(); boolean ret = value.orAndAndNot(orset.value, andset.value, andnotset.value); canonicalize(); return ret; }
public boolean contains(Numberable o) { if (array != null) { return array[findPosition(o)] != null; } else { int number = o.getNumber(); if (number == 0) { throw new RuntimeException("unnumbered"); } return bits.get(number); } }
public Iterator<N> iterator() { if (array == null) { return new BitSetIterator(this); } else { return new NumberedSetIterator(this); } }
public void or(SharedBitSet other) { if (own) { value.or(other.value); } else { value = BitVector.or(value, other.value); own = true; } canonicalize(); }
public Object clone() { IterableSet<T> s = new IterableSet<T>(); s.addAll(this); return s; }
/** * Tells the <code>PhaseDumper</code> that a {@link Scene} transforming phase has started, so that it can dump the phases's * “before” files. If the phase is to be dumped, <code>dumpBefore</code> deletes any old graph files dumped * during previous runs of the phase. * * @param phaseName * the name of the phase that has just started. */ public void dumpBefore(String phaseName) { phaseStack.push(phaseName); if (isBodyDumpingPhase(phaseName)) { dumpAllBodies(phaseName + ".in", true); } }
public LargeNumberedMap(ArrayNumberer<K> universe) { this.universe = universe; int newsize = universe.size(); if (newsize < 8) { newsize = 8; } values = new Object[newsize]; }
/** * Creates a new unmodifiable iterable set as a copy of an existing one * * @param original * The original set to copy */ public UnmodifiableIterableSet(IterableSet<E> original) { for (E e : original) { super.add(e); } }
@Override public boolean add(T e) { // Expand array if necessary if (numElements == maxElements) { doubleCapacity(); } // Add element elements[numElements++] = e; return true; }
private static <E> PriorityQueue<E> newPriorityQueue(List<? extends E> universe, Map<E, Integer> ordinalMap) { if (universe.size() <= SmallPriorityQueue.MAX_CAPACITY) { return new SmallPriorityQueue<E>(universe, ordinalMap); } if (universe.size() <= MediumPriorityQueue.MAX_CAPACITY) { return new MediumPriorityQueue<E>(universe, ordinalMap); } return new LargePriorityQueue<E>(universe, ordinalMap); } }
@Override public boolean retainAll(Collection<?> c) { long mask = 0; for (Object o : c) { mask |= (1L << getOrdinal(o)); } long old = queue; queue &= mask; min = nextSetBit(min); return old != queue; }
public boolean orAndAndNot(SharedBitSet orset, BitVector andset, SharedBitSet andnotset) { acquire(); boolean ret = value.orAndAndNot(orset.value, andset, andnotset == null ? null : andnotset.value); canonicalize(); return ret; }
@Override @SuppressWarnings("unchecked") public Iterator<E> iterator() { if (firstItem == null || isEmpty()) { return (Iterator<E>) emptyIterator; } return new LinkIterator<E>(firstItem); }