public class PositionIterator extends java.lang.Object implements java.util.Iterator<Position>
Position instances, that is wrapped around
another 'parent' Iterator. The parent can be either another
PositionIterator, or an iterator over KnuthElements,
for example.next() method always returns a Position. The
getPos(Object) method can be overridden in subclasses
to take care of obtaining the LayoutManager or Position
from the object returned by the parent iterator's next() method.| Constructor and Description |
|---|
PositionIterator(java.util.Iterator parentIter)
Construct position iterator.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
checkNext() |
protected void |
endIter()
end (reset) iterator
|
protected LayoutManager |
getLM(java.lang.Object nextObj) |
LayoutManager |
getNextChildLM() |
protected Position |
getPos(java.lang.Object nextObj)
Default implementation assumes that the passed
nextObj is itself a Position, and just returns it. |
boolean |
hasNext() |
Position |
next() |
java.lang.Object |
peekNext() |
void |
remove() |
public PositionIterator(java.util.Iterator parentIter)
parentIter - an iterator to use as parentpublic LayoutManager getNextChildLM()
protected LayoutManager getLM(java.lang.Object nextObj)
nextObj - next object from which to obtain positionprotected Position getPos(java.lang.Object nextObj)
nextObj is itself a Position, and just returns it.
Subclasses for which this is not the case, must provide a
suitable override this method.nextObj - next object from which to obtain positionprotected boolean checkNext()
protected void endIter()
public boolean hasNext()
hasNext in interface java.util.Iterator<Position>public Position next() throws java.util.NoSuchElementException
next in interface java.util.Iterator<Position>java.util.NoSuchElementExceptionpublic java.lang.Object peekNext()
public void remove()
throws java.lang.UnsupportedOperationException
remove in interface java.util.Iterator<Position>java.lang.UnsupportedOperationExceptionCopyright 1999-2022 The Apache Software Foundation. All Rights Reserved.