checkpoint
[sbp.git] / src / edu / berkeley / sbp / util / TopologicalBag.java
index 2a1bb53..cdbe976 100644 (file)
@@ -31,7 +31,7 @@ public class TopologicalBag<K,V> implements MapBag<Topology<K>,V> {
     public void put(Topology<K> t, V v) {
         for(Topology<K> ht : h.keySet()) {
             if (t.disjoint(ht)) continue;
     public void put(Topology<K> t, V v) {
         for(Topology<K> ht : h.keySet()) {
             if (t.disjoint(ht)) continue;
-            if (t.equals(ht)) {
+            if (t.containsAll(ht) && ht.containsAll(t)) {
                 h.get(ht).add(v);
                 return;
             }
                 h.get(ht).add(v);
                 return;
             }
@@ -91,6 +91,13 @@ public class TopologicalBag<K,V> implements MapBag<Topology<K>,V> {
         return false;
     }
 
         return false;
     }
 
+    public boolean has(K k) {
+        for(Topology<K> t : h.keySet())
+            if (t.contains(k) && !h.get(t).isEmpty())
+                return true;
+        return false;
+    }
+
     private HashMap<K,Iterable<V>> cache = new HashMap<K,Iterable<V>>();
     public Iterable<V> getAll(Topology<K> k) { return h.get(k); }
     public Iterable<V> get(K k) {
     private HashMap<K,Iterable<V>> cache = new HashMap<K,Iterable<V>>();
     public Iterable<V> getAll(Topology<K> k) { return h.get(k); }
     public Iterable<V> get(K k) {