X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FForest.java;h=e53bfcb10e32111f87c3038254d3a82390a2b4c9;hp=7fde86e681d3ec06854a39ec798576b0b9430559;hb=5ae7d4fd7c53dab6df9aae2e42579efabf66f49e;hpb=1b5d6cf8ab6963d50c168c9daeb7887b45a343ea diff --git a/src/edu/berkeley/sbp/Forest.java b/src/edu/berkeley/sbp/Forest.java index 7fde86e..e53bfcb 100644 --- a/src/edu/berkeley/sbp/Forest.java +++ b/src/edu/berkeley/sbp/Forest.java @@ -127,7 +127,20 @@ public abstract class Forest /*extends PrintableTree>*/ public Ref() { } public Tree expand1() throws Ambiguous { - if (hp.size() > 1) throw new Ambiguous(this); + if (hp.size() > 1) { + HashSet> hf0 = new HashSet>(); + Iterator> ih = hp.iterator(); + ih.next().gather(hf0); + for(Forest f : hp) { + HashSet> hf1 = new HashSet>(); + f.gather(hf1); + hf0.retainAll(hf1); + } + HashSet> ht = new HashSet>(); + expand(ht, hf0, new Tree(null, "*")); + throw new Ambiguous((Forest)this, + (HashSet>)(Object)ht); + } return hp.iterator().next().expand1(); }