checkpoint
authoradam <adam@megacz.com>
Fri, 21 Jul 2006 02:38:40 +0000 (22:38 -0400)
committeradam <adam@megacz.com>
Fri, 21 Jul 2006 02:38:40 +0000 (22:38 -0400)
darcs-hash:20060721023840-5007d-a42e5a0db1fddfed163ae08fc6399e1c3163591f.gz

src/edu/berkeley/sbp/Atom.java
src/edu/berkeley/sbp/Parser.java
src/edu/berkeley/sbp/util/TopologicalBag.java

index 0989bc0..306e126 100644 (file)
@@ -11,8 +11,8 @@ import edu.berkeley.sbp.*;
 public abstract class Atom<T> extends Element implements Topology<Atom<T>> {
 
     public  abstract Topology<T>  underlying();
-    public    abstract String       toString();
-    public             StringBuffer toString(StringBuffer sb) { sb.append(this); return sb; }
+    public  abstract String       toString();
+    public           StringBuffer toString(StringBuffer sb) { sb.append(this); return sb; }
 
 }
 
index b2445b0..a440628 100644 (file)
@@ -144,7 +144,7 @@ public abstract class Parser<Tok, Result> {
                     // if the element following this position is an atom, copy the corresponding
                     // set of rows out of the "master" goto table and into this state's shift table
                     if (p.element() != null && p.element() instanceof Atom)
-                        state.shifts.addAll(state.gotoSetTerminals.subset(((Atom)p.element())));
+                        state.shifts.addAll(state.gotoSetTerminals.subset(((Atom)p.element()).underlying()));
                 }
             if (top instanceof IntegerTopology)
                 for(State<Tok> state : all_states.values()) {
@@ -237,7 +237,7 @@ public abstract class Parser<Tok, Result> {
                     Atom a = (Atom)position.element();
                     HashSet<Position> hp = new HashSet<Position>();
                     reachable(position.next(), hp);
-                    bag0.addAll(a, hp);
+                    bag0.addAll(a.underlying(), hp);
                 }
 
                 // Step 1b: for each _minimal, contiguous_ set of characters having an identical next-position
index 1b2711d..2595602 100644 (file)
@@ -29,8 +29,6 @@ public class TopologicalBag<K,V> implements MapBag<Topology<K>,V>, VisitableMap<
 
     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)) {