public String toString() { if (isTop()) { return "{TOP}"; } else { return underlyingSet.toString(); } }
public boolean isEmpty() { if (isTop()) { return false; } return underlyingSet.isEmpty(); }
public void add(T obj) { if (isTop()) { return; } underlyingSet.add(obj); }
public void remove(T obj) { if (isTop()) { return; } underlyingSet.remove(obj); }
public boolean contains(T obj) { if (isTop()) { return true; } return underlyingSet.contains(obj); }
public List<T> toList() { if (isTop()) { throw new UnsupportedOperationException(); } return underlyingSet.toList(); }
public int size() { if (isTop()) { throw new UnsupportedOperationException(); } return underlyingSet.size(); }
@Override public Iterator<T> iterator() { if (isTop()) { throw new UnsupportedOperationException(); } return underlyingSet.iterator(); }
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 ToppedSet<T> clone() { ToppedSet<T> newSet = new ToppedSet<T>(underlyingSet.clone()); newSet.setTop(isTop()); 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); } }
protected void flowThrough(FlowSet<Value> in, Unit u, FlowSet<Value> out) { in.copy(out); if (((ToppedSet<Value>) in).isTop()) { return; } // Perform generation out.union(unitToGenerateSet.get(u), out); // Perform kill. if (((ToppedSet<Value>) out).isTop()) { throw new RuntimeException("trying to kill on topped set!"); } List<Value> l = new LinkedList<Value>(out.toList()); // iterate over things (avail) in out set. for (Value avail : l) { if (avail instanceof FieldRef) { if (st.unitCanWriteTo(u, avail)) { out.remove(avail, out); } } else { for (ValueBox vb : avail.getUseBoxes()) { Value use = vb.getValue(); if (st.unitCanWriteTo(u, use)) { out.remove(avail, out); } } } } }
Chain<EquivalentValue> equivsAfter = new HashChain<EquivalentValue>(); if (set instanceof ToppedSet && ((ToppedSet<Value>) set).isTop()) { throw new RuntimeException("top! on " + s);
public String toString() { if (isTop()) return "{TOP}"; else return underlyingSet.toString(); } }
public boolean isEmpty() { if (isTop()) return false; return underlyingSet.isEmpty(); }
public List toList() { if (isTop()) throw new UnsupportedOperationException(); return underlyingSet.toList(); }
public int size() { if (isTop()) throw new UnsupportedOperationException(); return underlyingSet.size(); }
public void add(Object obj) { if (isTop()) return; underlyingSet.add(obj); }