factored exceptions into non-inner classes
[sbp.git] / src / edu / berkeley / sbp / Forest.java
index dbcd3c0..917fea5 100644 (file)
@@ -10,9 +10,9 @@ import java.lang.reflect.*;
 public abstract class Forest<T> {
 
     /** assume that this forest contains exactly one tree and return it; otherwise throw an exception */
 public abstract class Forest<T> {
 
     /** assume that this forest contains exactly one tree and return it; otherwise throw an exception */
-    public final Tree<T> expand1() throws Parser.Ambiguous, Parser.Failed {
+    public final Tree<T> expand1() throws Ambiguous, ParseFailed {
         Iterator<Tree<T>> it = expand(true).iterator();
         Iterator<Tree<T>> it = expand(true).iterator();
-        if (!it.hasNext()) throw new Parser.Failed();
+        if (!it.hasNext()) throw new ParseFailed();
         return it.next();
     }
 
         return it.next();
     }
 
@@ -143,7 +143,7 @@ public abstract class Forest<T> {
             HashSet<Tree<T>> ret = new HashSet<Tree<T>>();
             for(Body<T> b : results)
                 ret.addAll(b.expand(toss, new ArrayList<Tree<T>>(), 0, new HashSet<Tree<T>>()));
             HashSet<Tree<T>> ret = new HashSet<Tree<T>>();
             for(Body<T> b : results)
                 ret.addAll(b.expand(toss, new ArrayList<Tree<T>>(), 0, new HashSet<Tree<T>>()));
-            if (toss && ret.size() > 1) throw new Parser.Ambiguous(this);
+            if (toss && ret.size() > 1) throw new Ambiguous(this);
             return ret;
         }
         
             return ret;
         }