/** * @throws IllegalArgumentException if x is null */ public BimodalMutableIntSet(BimodalMutableIntSet x) { if (x == null) { throw new IllegalArgumentException("x is null"); } impl = IntSetUtil.makeMutableCopy(x.impl); assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
/** * @throws IllegalArgumentException if x is null */ public BimodalMutableIntSet(BimodalMutableIntSet x) { if (x == null) { throw new IllegalArgumentException("x is null"); } impl = IntSetUtil.makeMutableCopy(x.impl); assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
/** * @throws IllegalArgumentException if x is null */ public BimodalMutableIntSet(BimodalMutableIntSet x) { if (x == null) { throw new IllegalArgumentException("x is null"); } impl = IntSetUtil.makeMutableCopy(x.impl); assert impl instanceof BitVectorIntSet || impl instanceof MutableSparseIntSet; }
@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; }
@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; }
@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; }
public static BimodalMutableIntSet makeCopy(IntSet B) throws UnimplementedError, IllegalArgumentException { if (B == null) { throw new IllegalArgumentException("B == null"); } if (B instanceof BimodalMutableIntSet) { BimodalMutableIntSet that = (BimodalMutableIntSet) B; BimodalMutableIntSet result = new BimodalMutableIntSet(); result.impl = IntSetUtil.makeMutableCopy(that.impl); return result; } else if (B instanceof MutableSharedBitVectorIntSet) { BimodalMutableIntSet result = new BimodalMutableIntSet(); MutableSharedBitVectorIntSet s = (MutableSharedBitVectorIntSet) B; result.impl = IntSetUtil.makeMutableCopy(s.makeSparseCopy()); assert result.impl instanceof BitVectorIntSet || result.impl instanceof MutableSparseIntSet; return result; } else { BimodalMutableIntSet result = new BimodalMutableIntSet(); result.impl = IntSetUtil.makeMutableCopy(B); assert result.impl instanceof BitVectorIntSet || result.impl instanceof MutableSparseIntSet; return result; } }
public static BimodalMutableIntSet makeCopy(IntSet B) throws UnimplementedError, IllegalArgumentException { if (B == null) { throw new IllegalArgumentException("B == null"); } if (B instanceof BimodalMutableIntSet) { BimodalMutableIntSet that = (BimodalMutableIntSet) B; BimodalMutableIntSet result = new BimodalMutableIntSet(); result.impl = IntSetUtil.makeMutableCopy(that.impl); return result; } else if (B instanceof MutableSharedBitVectorIntSet) { BimodalMutableIntSet result = new BimodalMutableIntSet(); MutableSharedBitVectorIntSet s = (MutableSharedBitVectorIntSet) B; result.impl = IntSetUtil.makeMutableCopy(s.makeSparseCopy()); assert result.impl instanceof BitVectorIntSet || result.impl instanceof MutableSparseIntSet; return result; } else { BimodalMutableIntSet result = new BimodalMutableIntSet(); result.impl = IntSetUtil.makeMutableCopy(B); assert result.impl instanceof BitVectorIntSet || result.impl instanceof MutableSparseIntSet; return result; } }
@Override public IntSet getSuccNodeNumbers(T node) { if (original.containsNode(node)) { if (outEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getSuccNodeNumbers(node)); x.addAll(outEdges.get(node)); return x; } else { return original.getSuccNodeNumbers(node); } } else { if (outEdges.containsKey(node)) { return outEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getPredNodeNumbers(T node) { if (original.containsNode(node)) { if (inEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getPredNodeNumbers(node)); x.addAll(inEdges.get(node)); return x; } else { return original.getPredNodeNumbers(node); } } else { if (inEdges.containsKey(node)) { return inEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getSuccNodeNumbers(T node) { if (original.containsNode(node)) { if (outEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getSuccNodeNumbers(node)); x.addAll(outEdges.get(node)); return x; } else { return original.getSuccNodeNumbers(node); } } else { if (outEdges.containsKey(node)) { return outEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getSuccNodeNumbers(T node) { if (original.containsNode(node)) { if (outEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getSuccNodeNumbers(node)); x.addAll(outEdges.get(node)); return x; } else { return original.getSuccNodeNumbers(node); } } else { if (outEdges.containsKey(node)) { return outEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getPredNodeNumbers(T node) { if (original.containsNode(node)) { if (inEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getPredNodeNumbers(node)); x.addAll(inEdges.get(node)); return x; } else { return original.getPredNodeNumbers(node); } } else { if (inEdges.containsKey(node)) { return inEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getPredNodeNumbers(T node) { if (original.containsNode(node)) { if (inEdges.containsKey(node)) { MutableIntSet x = IntSetUtil.makeMutableCopy(original.getPredNodeNumbers(node)); x.addAll(inEdges.get(node)); return x; } else { return original.getPredNodeNumbers(node); } } else { if (inEdges.containsKey(node)) { return inEdges.get(node); } else { return EmptyIntSet.instance; } } }
@Override public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) { MutableIntSet x = IntSetUtil.makeMutableCopy(base.getRelevantParameters(caller, site)); x.addAll(isFindStatic(site.getDeclaredTarget())? params: self); return x; } }
@Override public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) { MutableIntSet x = IntSetUtil.makeMutableCopy(base.getRelevantParameters(caller, site)); x.addAll(isFindStatic(site.getDeclaredTarget())? params: self); return x; } }
private IntSet getRelevantParameters(final CGNode caller, final CallSiteReference site) throws UnimplementedError { IntSet params = contextSelector.getRelevantParameters(caller, site); if (!site.isStatic() && !params.contains(0)) { params = IntSetUtil.makeMutableCopy(params); ((MutableIntSet)params).add(0); } return params; }
private IntSet getRelevantParameters(final CGNode caller, final CallSiteReference site) throws UnimplementedError { IntSet params = contextSelector.getRelevantParameters(caller, site); if (!site.isStatic() && !params.contains(0)) { params = IntSetUtil.makeMutableCopy(params); ((MutableIntSet)params).add(0); } return params; }
@Override public boolean addInverseFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { int idx = system.findOrCreateIndexForInstanceKey(concreteType); if (!R.contains(idx) || L.contains(idx)) { return L.addAll(R); } else { MutableIntSet copy = IntSetUtil.makeMutableCopy(R.getValue()); copy.remove(idx); return L.addAll(copy); } }
@Override public boolean addInverseFiltered(PropagationSystem system, PointsToSetVariable L, PointsToSetVariable R) { int idx = system.findOrCreateIndexForInstanceKey(concreteType); if (!R.contains(idx) || L.contains(idx)) { return L.addAll(R); } else { MutableIntSet copy = IntSetUtil.makeMutableCopy(R.getValue()); copy.remove(idx); return L.addAll(copy); } }