Paste: variant iterator

Author: j
Mode: text
Date: Thu, 10 Feb 2011 11:21:04
Plain Text |
variant QueryIterator = LeafIterator | UnionIterator;

record LeafIterator(...);
record UnionIterator(
    left: UniqueValue[QueryIterator],
    right: UniqueValue[QueryIterator],
);

overload hasNext?(i:QueryIterator) = hasNext?(*i);
overload next(i:QueryIterator) = next(*i);

overload hasNext?(i:UnionIterator) = hasNext?(i.left^) or hasNext?(i.right^);
overload next(i:UnionIterator) = unionNext(i.left^, i.right^);

private unionNext(left, right) = ...; 

New Annotation

Summary:
Author:
Mode:
Body: