- public Forest.Ref holder() { return holder==null ? (holder = new Forest.Ref()) : holder; }
- public Forest pending() { return Phase.this.closed ? holder().resolve() : holder; }
- public FastSet<Node> parents() { return this; }
+ //private HashMap<Node,Forest> resultMap = new HashMap<Node,Forest>();
+
+ private HashSet<Forest.Ref> resultMap = new HashSet<Forest.Ref>();
+ public void merge(Node parent, Forest result) {
+ for(Forest.Ref f : results()) {
+ if (f.parents.contains(parent) && f.parents.size()==1) {
+ f.merge(result);
+ return;
+ }
+ }
+ Forest.Ref f = new Forest.Ref();
+ f.parents.add(parent);
+ f.merge(result);
+ resultMap.add(f);
+ set.add(parent, true);
+ /*
+ Forest.Ref f = (Forest.Ref)resultMap.get(parent);
+ if (f==null) { f = new Forest.Ref(); resultMap.put(parent, f); }
+ f.merge(result);
+ set.add(parent, true);
+ */
+ }
+ public Iterable<Forest.Ref> results() { return resultMap; }
+ //private Forest pending(Node n) {
+ //return !Phase.this.closed ? holder : holder.resolve();
+ /*
+ for(Forest f : resultMap)
+ if (resultMap.contains(f, n))
+ return f;
+ return null;
+ */
+ /*
+ return resultMap.get(n);
+ }
+ */
+ public FastSet<Node> parents() { return set; }