From 6caa23ec64fa689a91c0b81238d04ff7322a945c Mon Sep 17 00:00:00 2001 From: adam Date: Sun, 1 Jan 2006 21:32:14 -0500 Subject: [PATCH] dropped Atom.top() darcs-hash:20060102023214-5007d-aa1057910e3d5e198a4fb7bdea5d344ef11a2ced.gz --- src/edu/berkeley/sbp/Atom.java | 2 -- src/edu/berkeley/sbp/Parser.java | 4 ++-- src/edu/berkeley/sbp/Walk.java | 6 +++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/edu/berkeley/sbp/Atom.java b/src/edu/berkeley/sbp/Atom.java index 8c702a1..1b9c254 100644 --- a/src/edu/berkeley/sbp/Atom.java +++ b/src/edu/berkeley/sbp/Atom.java @@ -14,8 +14,6 @@ public abstract class Atom extends Element implements Topology< public Atom(Topology rt) { this.rt = rt; } - Topology top() { return rt; } - void reachable(HashSet h) { /* do-nothing */ } /** equality is based on the underlying Topology */ diff --git a/src/edu/berkeley/sbp/Parser.java b/src/edu/berkeley/sbp/Parser.java index 046e725..6986a4b 100644 --- a/src/edu/berkeley/sbp/Parser.java +++ b/src/edu/berkeley/sbp/Parser.java @@ -153,7 +153,7 @@ public class Parser { // 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()).top())); + state.shifts.addAll(state.gotoSetTerminals.subset(((Atom)p.element()).dup())); } } @@ -224,7 +224,7 @@ public class Parser { Atom a = (Atom)position.element(); HashSet hp = new HashSet(); position.next().reachable(hp); - bag0.addAll(a.top(), /*clo.walk()*/hp); + bag0.addAll(a.dup(), /*clo.walk()*/hp); } // Step 1b: for each _minimal, contiguous_ set of characters having an identical next-position diff --git a/src/edu/berkeley/sbp/Walk.java b/src/edu/berkeley/sbp/Walk.java index 5754726..abbffd7 100644 --- a/src/edu/berkeley/sbp/Walk.java +++ b/src/edu/berkeley/sbp/Walk.java @@ -52,7 +52,7 @@ abstract class Walk { public HashSet bottom(Element e) { return acc; } public HashSet sequence(Sequence seq) { return bottom(seq); } public HashSet walkAtom(Atom r) { - c.atoms.put(e, c.atoms.get(e)==null ? r.top() : c.atoms.get(e).union(r.top())); + c.atoms.put(e, c.atoms.get(e)==null ? r.dup() : c.atoms.get(e).union(r.dup())); return super.walkAtom(r); } } @@ -83,7 +83,7 @@ abstract class Walk { public WalkTokenSet(Topology cs) { this.cs = cs; } public WalkTokenSet(Topology cs, Cache c) { super(c); this.cs = cs; } public Topology bottom(Element e) { return cs; } - public Topology walkAtom(Atom r) { cs.add(r.top()); return cs; } + public Topology walkAtom(Atom r) { cs.add(r.dup()); return cs; } } class First extends WalkTokenSet { @@ -152,7 +152,7 @@ abstract class Walk { if (e instanceof Atom) { Topology top = c.atoms.get(pos.element()); if (top==null) continue; - if (!(top.containsAll(((Atom)e).top()))) continue; + if (!(top.containsAll(((Atom)e).dup()))) continue; } else { if (c.ys.get(pos.element()).contains(e)) good = true; } -- 1.7.10.4