@Revision(value="$Revision: 1.6 $", date="$Date: 2006/11/09 02:10:05 $", tag="$Name: $")

Package rcf.core.util.iterator

TODO: Javadoc An Iterator is a Position which can be moved over whatever spatial relationship it is aware of.

See:
          Description

Interface Summary
ImmutableIterable<T> TODO: Javadoc This interface includes all of the methods needed to check the size of, and handle positions.
ImmutableIterator<T> TODO: Javadoc An extension of the ImmutablePosition interface, which adds support for forking this iterator.
Iterable<T> TODO: Javadoc An extension of the ImmutableIterable interface which adds support for mutating the elements at it's positions.
Iterator<T> TODO: Javadoc A combination of the ImmutableIterator and Position interfaces which supports iteration over an Iterable.
 

Package rcf.core.util.iterator Description

TODO: Javadoc An Iterator is a Position which can be moved over whatever spatial relationship it is aware of. Thus a OrderedBiIterator can be moved forward and backwards through the Ordering.Ordered relationship it abstracts. In the absence of calls to the iteration methods, an iterator will behave exactly as whichever Position it extends.

Note that by default in the java collections framework Iterators start off before the beginning of the iteration, thereby requiring a call to Iterator.next() simply to get the first element. This is in part becase a java iterator does not represent a position, but some halfway point between two positions. RCF iterators by contrast start at the first element, thereby reinforcing the extension of Positions. This has the added bonus that the ImmutableSingletonInterface.get() method can be used to retrieve the current element more than once, whereas code which uses standard java iterators must store the elements returned by Iterator.next() in similar situations.

Iterators are generally unsuitable for use in hash and identity based collections, because, for example, the ImmutableFixedUniIterator.next(rcf.core.util.filter.Filter) and ImmutableBiIterator.prev(rcf.core.util.filter.Filter) methods change the identity of the iterator, which is actually the identity of the current position.

The interfaces in this package do not actually provide any way to start an iteration, or to advance an iterator. The reason for this is simple, take for example, ImmutableCollections and ImmutableTrees, the two of which will require different methods for starting an iteration and navigating an iterator over the various positions. Because these methods must be so different, they are left to the appropriate packages: rcf.core.util.collection.iterator and rcf.core.util.tree.iterator in this example.

TODO: Javadoc review, Seal/Finalize

Author:
Greg Gibeling