X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FForest.java;fp=src%2Fedu%2Fberkeley%2Fsbp%2FForest.java;h=ee3bfbcf75c21c792419635b0e314b193db78886;hp=4f79bb607301ff1073248f8c9275a5a20f6ddb67;hb=2cca97362e80d5a3cd3e02d791a10cd7c6f6b29c;hpb=cd8ef445dd069efec7d47ab1df0c1f93caa2beac diff --git a/src/edu/berkeley/sbp/Forest.java b/src/edu/berkeley/sbp/Forest.java index 4f79bb6..ee3bfbc 100644 --- a/src/edu/berkeley/sbp/Forest.java +++ b/src/edu/berkeley/sbp/Forest.java @@ -34,7 +34,8 @@ public abstract class Forest implements GraphViz.ToGraphViz { abstract void gather(HashSet> ignore); abstract void edges(GraphViz.Node n); boolean ambiguous() { return false; } - + + abstract Input.Region getRegion(); // One ////////////////////////////////////////////////////////////////////////////// @@ -48,6 +49,8 @@ public abstract class Forest implements GraphViz.ToGraphViz { /** if true, the last child's children are considered children of this node */ private final boolean lift; + Input.Region getRegion() { return location; } + private One(Input.Region loc, NodeType head, Forest[] children, boolean lift) { this.location = loc; this.head = head; @@ -129,6 +132,8 @@ public abstract class Forest implements GraphViz.ToGraphViz { public Many() { } + Input.Region getRegion() { return hp.iterator().next().getRegion(); } // all should be identical + public Tree expand1() throws Ambiguous { touched(); if (hp.size() > 1) {