public void difference(FlowSet<T> o, FlowSet<T> d) { ToppedSet<T> other = (ToppedSet<T>) o, dest = (ToppedSet<T>) d; if (isTop()) { if (other.isTop()) { dest.clear(); } else if (other.underlyingSet instanceof BoundedFlowSet) { ((BoundedFlowSet<T>) other.underlyingSet).complement(dest); } else { throw new RuntimeException("can't take difference!"); } } else { if (other.isTop()) { dest.clear(); } else { underlyingSet.difference(other.underlyingSet, dest.underlyingSet); } } }
public FlowSet<T> emptySet() { return new ToppedSet<T>(underlyingSet.emptySet()); }
protected FlowSet<Value> newInitialFlow() { FlowSet<Value> newSet = emptySet.clone(); ((ToppedSet<Value>) newSet).setTop(true); return newSet; }
public String toString() { if (isTop()) { return "{TOP}"; } else { return underlyingSet.toString(); } }
emptySet = new ToppedSet<Value>(new ArraySparseSet<Value>());
protected Object newInitialFlow() { Object newSet = emptySet.clone(); ((ToppedSet)newSet).setTop(true); return newSet; }
public void union(FlowSet<T> o, FlowSet<T> d) { if (o instanceof ToppedSet && d instanceof ToppedSet) { ToppedSet<T> other = (ToppedSet<T>) o; ToppedSet<T> dest = (ToppedSet<T>) d; if (isTop()) { copy(dest); return; } if (other.isTop()) { other.copy(dest); } else { underlyingSet.union(other.underlyingSet, dest.underlyingSet); dest.setTop(false); } } else { super.union(o, d); } }
public boolean isEmpty() { if (isTop()) { return false; } return underlyingSet.isEmpty(); }
if (isTop()) { if (other.isTop()) dest.clear(); else if (other.underlyingSet instanceof BoundedFlowSet) ((BoundedFlowSet)other.underlyingSet).complement(dest); throw new RuntimeException("can't take difference!"); } else { if (other.isTop()) dest.clear(); else underlyingSet.difference(other.underlyingSet, dest.underlyingSet);
public Object emptySet() { return new ToppedSet((FlowSet)underlyingSet.emptySet()); }
protected Object newInitialFlow() { Object newSet = emptySet.clone(); ((ToppedSet)newSet).setTop(true); return newSet; }
public void union(FlowSet o, FlowSet d) { if (o instanceof ToppedSet && d instanceof ToppedSet) { ToppedSet other = (ToppedSet)o; ToppedSet dest = (ToppedSet)d; if (isTop()) { copy(dest); return; } if (other.isTop()) other.copy(dest); else { underlyingSet.union(other.underlyingSet, dest.underlyingSet); dest.setTop(false); } } else super.union(o, d); }
public void add(T obj) { if (isTop()) { return; } underlyingSet.add(obj); }