@Override public void foreach(IntSetAction action) { impl.foreach(action); }
public void remove(int i) { if (V != null) { V.remove(i); } }
/** * Intersect this with another set. */ @Override public void intersectWith(IntSet set) { if (set instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) set; primaryImpl.intersectWith(db.primaryImpl); secondaryImpl.intersectWith(db.secondaryImpl); if (!primaryImpl.sameValue(secondaryImpl)) assert false : this + " (" + primaryImpl.size() + ", " + secondaryImpl.size() + ") inconsistent after intersecting with " + set; } else { Assertions.UNREACHABLE(); } }
/** * Set the value of this to be the same as the value of set */ @Override public void copySet(IntSet set) { if (set instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) set; primaryImpl.copySet(db.primaryImpl); secondaryImpl.copySet(db.secondaryImpl); assert primaryImpl.sameValue(secondaryImpl); } else { Assertions.UNREACHABLE(); } }
temp.intersectWith(y); temp.copySet(x); temp.addAll(y); temp.copySet(x); MutableIntSet temp2 = factory.makeCopy(x); MutableIntSet tempY = factory.makeCopy(y); temp1.addAll(z); tempY.addAll(z); temp1.intersectWith(tempY); temp2.intersectWith(y); temp2.addAll(z); Assert.assertTrue(temp1.sameValue(temp2)); Assert.assertTrue(w.isEmpty()); Assert.assertTrue(IntSetUtil.diff(x, x, factory).isEmpty()); Assert.assertTrue(IntSetUtil.diff(z, v, factory).isEmpty()); Assert.assertTrue(IntSetUtil.diff(v, z, factory).sameValue(SparseIntSet.singleton(17))); Assert.assertTrue(IntSetUtil.diff(z, v, factory).isEmpty()); Assert.assertTrue(z.isSubset(v)); temp = factory.make(); temp.add(4); temp.add(7); temp.add(2);
@Override public boolean add(int i) { boolean result = impl.add(i); if (result) { maybeChangeRepresentation(); } return result; }
/** * add edges to nodes in callers of n */ private void addCallerEdges(CGNode n) { final int num = cg.getNumber(n); if (!cgNodesWithCallerEdges.contains(num)) { cgNodesWithCallerEdges.add(num); ControlFlowGraph<SSAInstruction, T> cfg = getCFG(n); addInterproceduralEdgesForEntryAndExitBlocks(n, cfg); } }
@Override public boolean addAll(IntSet set) { if (set instanceof BitVectorIntSet && !(impl instanceof BitVectorIntSet)) { // change the representation before performing the operation impl = new BitVectorIntSet(impl); } boolean result = impl.addAll(set); if (result) { maybeChangeRepresentation(); } return result; }
public boolean addAllInIntersection(IntSet other, IntSet filter) { if (V == null) { V = IntSetUtil.getDefaultIntSetFactory().makeCopy(other); V.intersectWith(filter); if (V.isEmpty()) { V = null; } return (V != null); } else { boolean result = V.addAllInIntersection(other, filter); return result; } }
/** * @param v a value number * @return true if the variable with the given value number has no uses */ public boolean isUnused(int v) { final MutableIntSet usesSet = uses[v]; assert usesSet == null || !usesSet.isEmpty(); return usesSet == null; } }
@Override public void copyState(T other) { if (V == null) { if (other.V == null) { return; } else { V = IntSetUtil.getDefaultIntSetFactory().makeCopy(other.V); return; } } else { if (other.V != null) { V.copySet(other.V); } } }
public boolean addAllInIntersection(T other, IntSet filter) { if (V == null) { copyState(other); if (V != null) { V.intersectWith(filter); if (V.isEmpty()) { V = null; } } return (V != null); } else { if (other.V != null) { boolean result = addAllInIntersection(other.V, filter); return result; } else { return false; } } }
@Override public void intersectWith(IntSet set) throws UnimplementedError { if (set == null) { throw new IllegalArgumentException("null set"); } if (set instanceof BimodalMutableIntSet) { BimodalMutableIntSet that = (BimodalMutableIntSet) set; impl.intersectWith(that.impl); } else { Assertions.UNREACHABLE(); } }
@Override protected void pathCallback(int i, int j, int k) { if (next[i][j] == null) { next[i][j] = IntSetUtil.make(); } next[i][j].add(k); }
/** * add edges to nodes in callers of n */ private void addCallerEdges(CGNode n) { final int num = cg.getNumber(n); if (!cgNodesWithCallerEdges.contains(num)) { cgNodesWithCallerEdges.add(num); ControlFlowGraph<SSAInstruction, T> cfg = getCFG(n); addInterproceduralEdgesForEntryAndExitBlocks(n, cfg); } }
/** * Intersect this with another set. */ @Override public void intersectWith(IntSet set) { if (set instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) set; primaryImpl.intersectWith(db.primaryImpl); secondaryImpl.intersectWith(db.secondaryImpl); if (!primaryImpl.sameValue(secondaryImpl)) assert false : this + " (" + primaryImpl.size() + ", " + secondaryImpl.size() + ") inconsistent after intersecting with " + set; } else { Assertions.UNREACHABLE(); } }