private OrdinalSet<InstanceKeyAndState> makeOrdinalSet(IntSet intSet) { // make a copy here, to avoid comodification during iteration // TODO remove the copying, do it only at necessary call sites return new OrdinalSet<>(intSetFactory.makeCopy(intSet), ikAndStates); }
private OrdinalSet<InstanceKeyAndState> makeOrdinalSet(IntSet intSet) { // make a copy here, to avoid comodification during iteration // TODO remove the copying, do it only at necessary call sites return new OrdinalSet<>(intSetFactory.makeCopy(intSet), ikAndStates); }
@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); } } }
@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); } } }
@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); } } }
private static IntSet defaultSlowDiff(IntSet A, IntSet B, MutableIntSetFactory<?> factory) { // TODO: this is slow ... optimize please. MutableIntSet result = factory.makeCopy(A); if (DEBUG) { System.err.println(("initial result " + result + ' ' + result.getClass())); } for (IntIterator it = B.intIterator(); it.hasNext();) { int I = it.next(); result.remove(I); if (DEBUG) { System.err.println(("removed " + I + " now is " + result)); } } if (DEBUG) { System.err.println(("return " + result)); } return result; }
@Override public DebuggingMutableIntSet makeCopy(IntSet x) throws UnimplementedError { if (x == null) { throw new IllegalArgumentException("null x"); } if (x instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) x; MutableIntSet pr = primary.makeCopy(db.primaryImpl); MutableIntSet sr = secondary.makeCopy(db.secondaryImpl); assert pr.sameValue(db.primaryImpl); assert sr.sameValue(db.secondaryImpl); assert pr.sameValue(sr); return new DebuggingMutableIntSet(pr, sr); } else { Assertions.UNREACHABLE(); return null; } }
private static IntSet defaultSlowDiff(IntSet A, IntSet B, MutableIntSetFactory<?> factory) { // TODO: this is slow ... optimize please. MutableIntSet result = factory.makeCopy(A); if (DEBUG) { System.err.println(("initial result " + result + ' ' + result.getClass())); } for (IntIterator it = B.intIterator(); it.hasNext();) { int I = it.next(); result.remove(I); if (DEBUG) { System.err.println(("removed " + I + " now is " + result)); } } if (DEBUG) { System.err.println(("return " + result)); } return result; }
@Override public DebuggingMutableIntSet makeCopy(IntSet x) throws UnimplementedError { if (x == null) { throw new IllegalArgumentException("null x"); } if (x instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) x; MutableIntSet pr = primary.makeCopy(db.primaryImpl); MutableIntSet sr = secondary.makeCopy(db.secondaryImpl); assert pr.sameValue(db.primaryImpl); assert sr.sameValue(db.secondaryImpl); assert pr.sameValue(sr); return new DebuggingMutableIntSet(pr, sr); } else { Assertions.UNREACHABLE(); return null; } }
private static IntSet defaultSlowDiff(IntSet A, IntSet B, MutableIntSetFactory<?> factory) { // TODO: this is slow ... optimize please. MutableIntSet result = factory.makeCopy(A); if (DEBUG) { System.err.println(("initial result " + result + ' ' + result.getClass())); } for (IntIterator it = B.intIterator(); it.hasNext();) { int I = it.next(); result.remove(I); if (DEBUG) { System.err.println(("removed " + I + " now is " + result)); } } if (DEBUG) { System.err.println(("return " + result)); } return result; }
@Override public DebuggingMutableIntSet makeCopy(IntSet x) throws UnimplementedError { if (x == null) { throw new IllegalArgumentException("null x"); } if (x instanceof DebuggingMutableIntSet) { DebuggingMutableIntSet db = (DebuggingMutableIntSet) x; MutableIntSet pr = primary.makeCopy(db.primaryImpl); MutableIntSet sr = secondary.makeCopy(db.secondaryImpl); assert pr.sameValue(db.primaryImpl); assert sr.sameValue(db.secondaryImpl); assert pr.sameValue(sr); return new DebuggingMutableIntSet(pr, sr); } else { Assertions.UNREACHABLE(); return null; } }
/** * Add all integers from the set B * * @return true iff the value of this changes */ public boolean addAll(IntSet B) { if (V == null) { V = IntSetUtil.getDefaultIntSetFactory().makeCopy(B); return (B.size() > 0); } else { boolean result = V.addAll(B); return result; } }
/** * Add all integers from the set B * * @return true iff the value of this changes */ public boolean addAll(IntSet B) { if (V == null) { V = IntSetUtil.getDefaultIntSetFactory().makeCopy(B); return (B.size() > 0); } else { boolean result = V.addAll(B); return result; } }
/** * @return a set of integers representing the instance keys that correspond to a given class. This method creates a new set, which * the caller may bash at will. */ MutableIntSet cloneInstanceKeysForClass(IClass klass) { assert klass.getReference() != TypeReference.JavaLangObject; MutableIntSet set = class2InstanceKey.get(klass); if (set == null) { return IntSetUtil.getDefaultIntSetFactory().make(); } else { // return a copy. return IntSetUtil.getDefaultIntSetFactory().makeCopy(set); } }
/** * Add all integers from the set B * * @return true iff the value of this changes */ public boolean addAll(IntSet B) { if (V == null) { V = IntSetUtil.getDefaultIntSetFactory().makeCopy(B); return (B.size() > 0); } else { boolean result = V.addAll(B); return result; } }
/** * @return a set of integers representing the instance keys that correspond to a given class. This method creates a new set, which * the caller may bash at will. */ MutableIntSet cloneInstanceKeysForClass(IClass klass) { assert klass.getReference() != TypeReference.JavaLangObject; MutableIntSet set = class2InstanceKey.get(klass); if (set == null) { return IntSetUtil.getDefaultIntSetFactory().make(); } else { // return a copy. return IntSetUtil.getDefaultIntSetFactory().makeCopy(set); } }
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; } }
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; } }
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; } }
MutableIntSet temp = factory.makeCopy(x); temp.intersectWith(y); MutableIntSet temp1 = factory.makeCopy(x); MutableIntSet temp2 = factory.makeCopy(x); MutableIntSet tempY = factory.makeCopy(y); temp1.addAll(z); tempY.addAll(z); Assert.assertFalse(f.contains(100)); b = factory.makeCopy(a); Assert.assertTrue(a.sameValue(b)); b.remove(1); Assert.assertTrue(a.isSubset(b)); b = factory.makeCopy(a); Assert.assertTrue(a.sameValue(b)); b.remove(1);