rcf.core.util.groups
Class ImmutableTriple.Iterator<A,B,C>

java.lang.Object
  extended by rcf.core.util.groups.ImmutableTriple.Iterator<A,B,C>
Type Parameters:
A - The type of the first entry in each triple.
B - The type of the second entry in each triple.
C - The type of the third entry in each triple.
All Implemented Interfaces:
rcf.core.util.collection.iterator.ImmutableFixedUniIterator<Triple<A,B,C>>, rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>>, rcf.core.util.Copyable, ImmutableSingletonInterface<Triple<A,B,C>>, ImmutableIterator<Triple<A,B,C>>, ImmutablePosition<Triple<A,B,C>>
Enclosing class:
ImmutableTriple<A,B,C>

public static class ImmutableTriple.Iterator<A,B,C>
extends Object
implements rcf.core.util.collection.iterator.ImmutableFixedUniIterator<Triple<A,B,C>>

TODO: Javadoc Binds a triple of immutable iterators, allowing them to be iterated simultaneously.

Version:
$Revision: 1.29 $
Author:
Greg Gibeling

Field Summary
protected  Triple<A,B,C> curr
          TODO: Javadoc The current triple created from the wrapped iterators.
protected  ImmutableTriple.Iterable<A,B,C> iterable
          TODO: Javadoc
protected  rcf.core.util.collection.iterator.ImmutableFixedUniIterator<A> x
          TODO: Javadoc The first immutable iterator which is being wrapped.
protected  rcf.core.util.collection.iterator.ImmutableFixedUniIterator<B> y
          TODO: Javadoc The second immutable iterator which is being wrapped.
protected  rcf.core.util.collection.iterator.ImmutableFixedUniIterator<C> z
          TODO: Javadoc The third immutable iterator which is being wrapped.
 
Constructor Summary
ImmutableTriple.Iterator(ImmutableTriple.Iterable<A,B,C> _iterable, rcf.core.util.collection.iterator.ImmutableFixedUniIterator<A> _a, rcf.core.util.collection.iterator.ImmutableFixedUniIterator<B> _b, rcf.core.util.collection.iterator.ImmutableFixedUniIterator<C> _c)
          TODO: Javadoc Create an immutable iterator triple from three immutable iterable objects.
 
Method Summary
 rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>> asAbstract()
           
 ImmutableTriple.Iterator<A,B,C> copy()
          TODO: Javadoc Return a new iterator which is currently at the same position as this iterator.
 boolean equals(Object o)
          Determine if the specified object is an instance of ImmutablPposition which represents the same position in the same abstract data structure, as this object.
 Triple<A,B,C> get()
          TODO: Javadoc Get the content element of this singleton.
 int hashCode()
           
 boolean isCompatible(ImmutablePosition<Triple<A,B,C>> p)
          Determine if this position is compatible to, i.e.
 boolean isPost()
           
 boolean isPre()
           
 boolean isSentinel()
          Determine if this position is a sentinel; i.e.
 ImmutableTriple.Iterable<A,B,C> iterable()
          TODO: Javadoc
 ImmutableTriple.Iterator<A,B,C> next(rcf.core.util.filter.Filter<Triple<A,B,C>> filter)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

curr

protected Triple<A,B,C> curr
TODO: Javadoc The current triple created from the wrapped iterators.


iterable

protected final ImmutableTriple.Iterable<A,B,C> iterable
TODO: Javadoc


x

protected final rcf.core.util.collection.iterator.ImmutableFixedUniIterator<A> x
TODO: Javadoc The first immutable iterator which is being wrapped.


y

protected final rcf.core.util.collection.iterator.ImmutableFixedUniIterator<B> y
TODO: Javadoc The second immutable iterator which is being wrapped.


z

protected final rcf.core.util.collection.iterator.ImmutableFixedUniIterator<C> z
TODO: Javadoc The third immutable iterator which is being wrapped.

Constructor Detail

ImmutableTriple.Iterator

public ImmutableTriple.Iterator(ImmutableTriple.Iterable<A,B,C> _iterable,
                                rcf.core.util.collection.iterator.ImmutableFixedUniIterator<A> _a,
                                rcf.core.util.collection.iterator.ImmutableFixedUniIterator<B> _b,
                                rcf.core.util.collection.iterator.ImmutableFixedUniIterator<C> _c)
TODO: Javadoc Create an immutable iterator triple from three immutable iterable objects. TODO: Javadoc

Parameters:
_iterable -
_a - The A type iterator object.
_b - The B type iterator object.
_c - The C type iterator object.
Method Detail

asAbstract

public rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>> asAbstract()
Specified by:
asAbstract in interface rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>>

copy

public ImmutableTriple.Iterator<A,B,C> copy()
Description copied from interface: ImmutableIterator
TODO: Javadoc Return a new iterator which is currently at the same position as this iterator. That is, this method will return an iterator i such that this.equals(i) && this.isCompatible(i) (notice that equals is symmetric but isCompatible is not). Note that a call to e.g. ImmutableFixedUniIterator.next(rcf.core.util.filter.Filter) on this must not affect i and vice-versa.

This method is extremely useful in conjunction with position based collections where iteration is expensive or positions have algorithmic importance or higher level semantics.

Specified by:
copy in interface rcf.core.util.collection.iterator.ImmutableFixedUniIterator<Triple<A,B,C>>
Specified by:
copy in interface rcf.core.util.Copyable
Specified by:
copy in interface ImmutableIterator<Triple<A,B,C>>
Returns:
A new iterator i such that this.equals(i).

equals

public boolean equals(Object o)
Description copied from interface: ImmutablePosition
Determine if the specified object is an instance of ImmutablPposition which represents the same position in the same abstract data structure, as this object. Notice that for positions p and q, p.equals(q) implies p.isCompatible(q) && q.isCompatible(p).

Specified by:
equals in interface ImmutablePosition<Triple<A,B,C>>
Overrides:
equals in class Object
Parameters:
o - The object to compare this one to, for equality.
Returns:
true if this position and the one specified represent the same position, in the same abstract data structure.

get

public Triple<A,B,C> get()
Description copied from interface: ImmutableSingletonInterface
TODO: Javadoc Get the content element of this singleton.

Specified by:
get in interface ImmutableSingletonInterface<Triple<A,B,C>>
Returns:
The content element of this singleton.

hashCode

public int hashCode()
Overrides:
hashCode in class Object

isCompatible

public boolean isCompatible(ImmutablePosition<Triple<A,B,C>> p)
Description copied from interface: ImmutablePosition
Determine if this position is compatible to, i.e. indicates a position in the same abstract data structure as, the specfied position (should return true even for sentinel positions). This method should never throw exceptions (especially IncompatiblePositionException) as it is a test to avoid them.

Specified by:
isCompatible in interface ImmutablePosition<Triple<A,B,C>>
Parameters:
p - The position to determine if this one is compatible to.
Returns:
true indicates that this position and the specified one belong to the same abstract data structure.

isPost

public boolean isPost()
Specified by:
isPost in interface rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>>

isPre

public boolean isPre()
Specified by:
isPre in interface rcf.core.util.collection.position.ImmutableFixedUniPosition<Triple<A,B,C>>

isSentinel

public boolean isSentinel()
Description copied from interface: ImmutablePosition
Determine if this position is a sentinel; i.e. a position which does not contain an element in the backing abstract data structure, but which instead marks the start or end of an iteration or some other boundary condition.

Specified by:
isSentinel in interface ImmutablePosition<Triple<A,B,C>>
Returns:
true if this is a sentinel position.

iterable

public ImmutableTriple.Iterable<A,B,C> iterable()
Description copied from interface: ImmutableIterator
TODO: Javadoc

Specified by:
iterable in interface rcf.core.util.collection.iterator.ImmutableFixedUniIterator<Triple<A,B,C>>
Specified by:
iterable in interface ImmutableIterator<Triple<A,B,C>>
Returns:

next

public ImmutableTriple.Iterator<A,B,C> next(rcf.core.util.filter.Filter<Triple<A,B,C>> filter)
Specified by:
next in interface rcf.core.util.collection.iterator.ImmutableFixedUniIterator<Triple<A,B,C>>

toString

public String toString()
Overrides:
toString in class Object