|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcommon.AbstractTupleIterator
public abstract class AbstractTupleIterator
An iterator over the set of tuples (x1, ..., xk) such that
x1 is in S1, x2 is in S2(x1), etc., and
xk is in Sk(x1, ..., x(k-1)). This is a generalization
of the standard TupleIterator, where Si does not depend on
x1, ..., x(i-1). Subclasses should override the
getIterator
method.
The algorithm is depth-first search on a tree where edges are labeled with tuple elements. If a node is reached by the path x1, ..., x(i-1), then its children are labeled with the elements of Si(x1, ..., x(i-1)). A node at depth k corresponds to a complete tuple. If some of the sets Si are empty, then some nodes at depths less than k are dead ends with no children. The algorithm backtracks when it reaches one of these nodes.
Constructor Summary | |
---|---|
AbstractTupleIterator(int k)
Creates a new AbstractTupleIterator for tuples of length k . |
Method Summary | |
---|---|
protected void |
doneWithIterator(java.util.Iterator iter)
Method called whenever the AbstractTupleIterator is done with an iterator returned earlier by getIterator (i.e.,
that iterator's hasNext method has returned false). |
protected abstract java.util.Iterator |
getIterator(int indexInTuple,
java.util.List tuple)
Returns an iterator over the ith set given that x1, ..., x(i-1) have the values specified in the given tuple. |
boolean |
hasNext()
Returns true if there are any more tuples to return. |
java.lang.Object |
next()
Returns another tuple not returned previously. |
void |
remove()
OPTIONAL METHOD -- NOT IMPLEMENTED. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractTupleIterator(int k)
k
.
Method Detail |
---|
public boolean hasNext()
hasNext
in interface java.util.Iterator
public java.lang.Object next()
next
in interface java.util.Iterator
public void remove()
remove
in interface java.util.Iterator
protected abstract java.util.Iterator getIterator(int indexInTuple, java.util.List tuple)
indexInTuple
- the index iprotected void doneWithIterator(java.util.Iterator iter)
getIterator
(i.e.,
that iterator's hasNext
method has returned false).
The default implementation does nothing, but subclasses can
override it.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |