+ public boolean contains(Sequence s) {
+ viewed = true;
+ return alternatives.contains(s);
+ }
+
+ /** iterator over this Union's Sequences */
+ public Iterator<Sequence> iterator() {
+ viewed = true;
+ return alternatives.iterator();
+ }
+
+ /** adds an alternative */
+ public Union add(Sequence s) {
+ if (viewed)
+ throw new RuntimeException("once Union.contains() or Union.iterator() has been invoked, "+
+ "you may not add any more Sequences to it\n "+
+ " union in question: " + this);
+ if (s.needed_or_hated)
+ throw new RuntimeException("you may not add a conjunct directly to a Union");
+ s.in_a_union = true;
+ if (alternatives.contains(s)) return this;
+ alternatives.add(s);
+ return this;
+ }
+
+ /** adds a one-element sequence */
+ public void add(Element e) {
+ add(Sequence.create(e));
+ }
+
+
+ // Epsilon Form //////////////////////////////////////////////////////////////////////////////