checkpoint
[sbp.git] / src / edu / berkeley / sbp / Sequence.java
index 8995b5c..f21bb80 100644 (file)
@@ -62,6 +62,7 @@ public abstract class Sequence extends Element implements Iterable<Element> {
     Position firstp() { return firstp; }
 
     public Iterator<Element> iterator()    { return new ArrayIterator<Element>(elements); }
+    protected Sequence(Element[] elements) { this(elements, null, null); }
     protected Sequence(Element[] elements, HashSet<Sequence> and, HashSet<Sequence> not) {
         if (and!=null) for(Sequence s : and) { needs.add(s); s.needed.add(this); }
         if (not!=null) for(Sequence s : not) { hates.add(s); s.hated.add(this); }
@@ -198,10 +199,10 @@ public abstract class Sequence extends Element implements Iterable<Element> {
 
     public static class Unwrap extends Sequence {
         private boolean[] drops;
-        public Unwrap(Element[] e, HashSet<Sequence> and, HashSet<Sequence> not)                  { super(e, and, not); this.drops = null; }
-        public Unwrap(Element[] e, boolean[] drops, HashSet<Sequence> and, HashSet<Sequence> not) { super(e, and, not); this.drops = drops; }
-        public Sequence and(Sequence s) { Sequence ret = new Unwrap(elements, drops, needs, hates); ret.needs(s); return ret; }
-        public Sequence not(Sequence s) { Sequence ret = new Unwrap(elements, drops, needs, hates); ret.hates(s); return ret; }
+        public Unwrap(Element[] e)                  { super(e); this.drops = null; }
+        public Unwrap(Element[] e, boolean[] drops) { super(e); this.drops = drops; }
+        public Sequence and(Sequence s) { Sequence ret = new Unwrap(elements, drops); ret.needs(s); return ret; }
+        public Sequence not(Sequence s) { Sequence ret = new Unwrap(elements, drops); ret.hates(s); return ret; }
         public <T> Forest<T> postReduce(Input.Location loc, Forest<T>[] args) {
             for(int i=0; i<args.length; i++) if (args[i]==null) throw new Error();
             if (drops==null) return Forest.create(loc, null, args, true, false);