+// Copyright 2006-2007 all rights reserved; see LICENSE file for BSD-style license
+
package edu.berkeley.sbp.util;
import edu.berkeley.sbp.util.*;
import edu.berkeley.sbp.*;
//
/** a mapping from topologies over <tt>K</tt> to <i>sets of</i> values of type <tt>V</tt> */
-public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<K,V> {
+public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<K,V>, Serializable {
// CRUCIAL INVARIANT: keys in this hashmap MUST be disjoint or the universe will implode
private final HashMap<Topology<K>,HashSet<V>> h = new HashMap<Topology<K>,HashSet<V>>();
public void putAll(Topology<K> k, Iterable<V> vi) { if (vi!=null) for(V v : vi) put(k, v); }
public void put(Topology<K> t, V v) {
- // XXX hack
- if (t instanceof Atom) t = ((Atom)t).underlying();
for(Topology<K> ht : h.keySet()) {
if (t.disjoint(ht)) continue;
if (t.containsAll(ht) && ht.containsAll(t)) {