- }
-
- // SubUnion //////////////////////////////////////////////////////////////////////////////
-
- /** FIXME this is kind of a hack */
- public class Subset extends Union {
- private final Set<Sequence> exclude;
- public Subset(String shortForm, Set<Sequence> exclude) { super(shortForm, true); this.exclude = exclude; }
- public Iterator<Sequence> iterator() {
- final Iterator<Sequence> it = Union.this.iterator();
- return new Iterator<Sequence>() {
- private Sequence next = it.hasNext() ? it.next() : null;
- public boolean hasNext() { return next != null; }
- public Sequence next() {
- Sequence ret = next;
- do {
- next = it.hasNext() ? it.next() : null;
- } while (next != null && (next instanceof Sequence) && exclude.contains((Sequence)next));
- return ret;
- }
- public void remove() { throw new Error(); }
- };
- }