From f9536341fe8a0fc979f307d9ad5a189c96ec5850 Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 4 Jan 2006 04:36:44 -0500 Subject: [PATCH] checkpoint darcs-hash:20060104093644-5007d-7222a88b6eeb5c4c298d2f1519d5c6f1fa1bf71b.gz --- src/edu/berkeley/sbp/GSS.java | 17 ++++++++--------- src/edu/berkeley/sbp/util/FastSet.java | 7 ++++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/edu/berkeley/sbp/GSS.java b/src/edu/berkeley/sbp/GSS.java index 45de091..abe4aa3 100644 --- a/src/edu/berkeley/sbp/GSS.java +++ b/src/edu/berkeley/sbp/GSS.java @@ -78,8 +78,8 @@ class GSS { } private void newNode2(Node p, Node parent, Forest pending, Parser.Table.State state, boolean fromEmptyReduction, Phase start) { p.holder.merge(pending); - if (p.parents.contains(parent)) return; - p.parents.add(parent, true); + if (p.parents().contains(parent)) return; + p.parents().add(parent, true); if (p!=parent && !fromEmptyReduction) p.queueReductions(parent); } private void newNode3(Node parent, Forest pending, Parser.Table.State state, boolean fromEmptyReduction, Phase start) { @@ -163,7 +163,7 @@ class GSS { // GSS Nodes ////////////////////////////////////////////////////////////////////////////// /** a node in the GSS */ - public final class Node { + public final class Node extends FastSet { private Forest.Ref holder = null; private boolean allqueued = false; @@ -171,7 +171,7 @@ class GSS { private HashMap cache = null; /** the set of nodes to which there is an edge starting at this node */ - public final FastSet parents = new FastSet(); /* ALLOC */ + //public final FastSet parents = new FastSet(); /* ALLOC */ /** what state this node is in */ public final Parser.Table.State state; @@ -183,15 +183,14 @@ class GSS { return cache==null ? (cache = new HashMap()) : cache; } public Forest.Ref holder() { return holder==null ? (holder = new Forest.Ref()) : holder; } public Forest pending() { return Phase.this.closed ? holder().resolve() : holder; } - public FastSet parents() { return parents; } + public FastSet parents() { return this; } /** FIXME */ public void queueReductions() { if (allqueued) return; allqueued = true; - FastSet h = new FastSet(); - for(Node n : parents) h.add(n); - for(Node n : h) queueReductions(n); + int where = parents().size(); + for(int i=0; i implements Iterator, Iterable { +public /*final*/ class FastSet implements Iterator, Iterable { public static final int INITIAL_SIZE = 128; @@ -14,6 +14,11 @@ public final class FastSet implements Iterator, Iterable { public void remove() { throw new Error(); } public boolean hasNext() { return only==null ? i