/** * Note that this variable appears on the RHS of an equation. * * @param eqNumber * the equation number */ @Override public void addSucc(int eqNumber) { if (succNumbers == null) { succNumbers = new BimodalMutableIntSet(); succNumbers.add(eqNumber); } else { succNumbers.add(eqNumber); } }
@Override public IntSet union(IntSet that) { BimodalMutableIntSet temp = new BimodalMutableIntSet(); temp.addAll(this); temp.addAll(that); return temp; }
@Override public BimodalMutableIntSet makeCopy(IntSet x) throws UnimplementedError, IllegalArgumentException { if (x == null) { throw new IllegalArgumentException("x == null"); } return BimodalMutableIntSet.makeCopy(x); }
@Override public BimodalMutableIntSet make() { return new BimodalMutableIntSet(); } }
@Override public boolean add(int i) { boolean result = impl.add(i); if (result) { maybeChangeRepresentation(); } return result; }
/** * TODO: optimize ME! * * @throws IllegalArgumentException if that is null */ public boolean containsAll(BimodalMutableIntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } for (IntIterator it = that.intIterator(); it.hasNext();) { if (!contains(it.next())) { return false; } } return true; } }
/** * TODO: optimize ME! * * @throws IllegalArgumentException if that is null */ public boolean removeAll(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } boolean result = false; for (IntIterator it = that.intIterator(); it.hasNext();) { result |= remove(it.next()); } return result; }
@Override public void copySet(IntSet set) { if (set == null) { throw new IllegalArgumentException("null set"); } if (set instanceof BimodalMutableIntSet) { impl = IntSetUtil.makeMutableCopy(((BimodalMutableIntSet) set).impl); } else if (sameRepresentation(impl, set)) { // V and other.V use the same representation. update in place. impl.copySet(set); } else if (set instanceof BitVectorIntSet || set instanceof SparseIntSet) { // other.V has a different representation. make a new copy impl = IntSetUtil.makeMutableCopy(set); } else if (set instanceof MutableSharedBitVectorIntSet) { impl = IntSetUtil.makeMutableCopy(((MutableSharedBitVectorIntSet) set).makeSparseCopy()); } else { Assertions.UNREACHABLE("Unexpected type " + set.getClass()); } assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
IntSet backing = ((BimodalMutableIntSet) set).getBackingStore(); copySet(backing); } else {
@Override public BimodalMutableIntSet make() { return new BimodalMutableIntSet(); } }
@Override public boolean remove(int i) { boolean result = impl.remove(i); maybeChangeRepresentation(); return result; }
/** * TODO: optimize ME! * * @throws IllegalArgumentException if that is null */ public boolean containsAll(BimodalMutableIntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } for (IntIterator it = that.intIterator(); it.hasNext();) { if (!contains(it.next())) { return false; } } return true; } }
/** * TODO: optimize ME! * * @throws IllegalArgumentException if that is null */ public boolean removeAll(IntSet that) { if (that == null) { throw new IllegalArgumentException("that is null"); } boolean result = false; for (IntIterator it = that.intIterator(); it.hasNext();) { result |= remove(it.next()); } return result; }
@Override public void copySet(IntSet set) { if (set == null) { throw new IllegalArgumentException("null set"); } if (set instanceof BimodalMutableIntSet) { impl = IntSetUtil.makeMutableCopy(((BimodalMutableIntSet) set).impl); } else if (sameRepresentation(impl, set)) { // V and other.V use the same representation. update in place. impl.copySet(set); } else if (set instanceof BitVectorIntSet || set instanceof SparseIntSet) { // other.V has a different representation. make a new copy impl = IntSetUtil.makeMutableCopy(set); } else if (set instanceof MutableSharedBitVectorIntSet) { impl = IntSetUtil.makeMutableCopy(((MutableSharedBitVectorIntSet) set).makeSparseCopy()); } else { Assertions.UNREACHABLE("Unexpected type " + set.getClass()); } assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
IntSet backing = ((BimodalMutableIntSet) set).getBackingStore(); copySet(backing); } else {
/** * Note that this variable appears on the LHS of an equation. * * @param eqNumber * the equation number */ @Override public void addPred(int eqNumber) { if (predNumbers == null) { predNumbers = new BimodalMutableIntSet(); predNumbers.add(eqNumber); } else { predNumbers.add(eqNumber); } }
@Override public BimodalMutableIntSet make() { return new BimodalMutableIntSet(); } }
@Override public IntSet union(IntSet that) { BimodalMutableIntSet temp = new BimodalMutableIntSet(); temp.addAll(this); temp.addAll(that); return temp; }