import java.lang.ref.*;
/** <font color=green>juxtaposition; zero or more adjacent Elements; can specify a rewriting</font> */
-public abstract class Sequence /*extends Element*/ implements Iterable<Element>, SequenceOrElement {
+public abstract class Sequence implements Iterable<Element>, SequenceOrElement {
protected final Element[] elements;
public Sequence and(Sequence s) { Sequence ret = dup(); ret.needs.add(s); return ret; }
/** return a new sequence identical to this one, but with a negative conjunct <tt>s</tt> */
- public Sequence not(Sequence s) { Sequence ret = dup(); ret.hates.add(s); s.hated.add(ret); return ret; }
+ public Sequence andnot(Sequence s) { Sequence ret = dup(); ret.hates.add(s); s.hated.add(ret); return ret; }
/** return a new sequence identical to this one, but with a follow-set restricted to <tt>a</tt> */
public Sequence followedBy(Atom a) { Sequence ret = dup(); ret.follow = a; return ret; }
sb.append("-> ");
sb.append(follow);
}
+ for(Sequence s : needs) {
+ sb.append("& ");
+ sb.append(s);
+ }
+ for(Sequence s : hates) {
+ sb.append("&~ ");
+ sb.append(s);
+ }
return sb;
}