X-Git-Url: http://git.megacz.com/?p=sbp.git;a=blobdiff_plain;f=src%2Fedu%2Fberkeley%2Fsbp%2FSequence.java;h=f21bb809b384e26b1bbf8ef383325acb5bad9d00;hp=8995b5c8576c96651d6d975037ec7822ebb3c28f;hb=5d3efb18a5ac20129a699102fa0099b98b558874;hpb=72a191a1440fcdc484700238e8be1384ccc56e06 diff --git a/src/edu/berkeley/sbp/Sequence.java b/src/edu/berkeley/sbp/Sequence.java index 8995b5c..f21bb80 100644 --- a/src/edu/berkeley/sbp/Sequence.java +++ b/src/edu/berkeley/sbp/Sequence.java @@ -62,6 +62,7 @@ public abstract class Sequence extends Element implements Iterable { Position firstp() { return firstp; } public Iterator iterator() { return new ArrayIterator(elements); } + protected Sequence(Element[] elements) { this(elements, null, null); } protected Sequence(Element[] elements, HashSet and, HashSet 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 { public static class Unwrap extends Sequence { private boolean[] drops; - public Unwrap(Element[] e, HashSet and, HashSet not) { super(e, and, not); this.drops = null; } - public Unwrap(Element[] e, boolean[] drops, HashSet and, HashSet 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 Forest postReduce(Input.Location loc, Forest[] args) { for(int i=0; i