Package org.apache.fop.layoutmgr
Class PositionIterator
- java.lang.Object
-
- org.apache.fop.layoutmgr.PositionIterator
-
- All Implemented Interfaces:
java.util.Iterator<Position>
- Direct Known Subclasses:
KnuthPossPosIter
public class PositionIterator extends java.lang.Object implements java.util.Iterator<Position>
An iterator overPosition
instances, that is wrapped around another 'parent'Iterator
. The parent can be either anotherPositionIterator
, or an iterator overKnuthElement
s, for example.
Thenext()
method always returns aPosition
. ThegetPos(Object)
method can be overridden in subclasses to take care of obtaining theLayoutManager
orPosition
from the object returned by the parent iterator'snext()
method.
-
-
Field Summary
Fields Modifier and Type Field Description private LayoutManager
childLM
private boolean
hasNext
private java.lang.Object
nextObj
private java.util.Iterator
parentIter
-
Constructor Summary
Constructors Constructor Description PositionIterator(java.util.Iterator parentIter)
Construct position iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
checkNext()
protected void
endIter()
end (reset) iteratorprotected LayoutManager
getLM(java.lang.Object nextObj)
LayoutManager
getNextChildLM()
protected Position
getPos(java.lang.Object nextObj)
Default implementation assumes that the passednextObj
is itself aPosition
, and just returns it.boolean
hasNext()
private void
lookAhead()
Position
next()
java.lang.Object
peekNext()
void
remove()
-
-
-
Field Detail
-
parentIter
private java.util.Iterator parentIter
-
nextObj
private java.lang.Object nextObj
-
childLM
private LayoutManager childLM
-
hasNext
private boolean hasNext
-
-
Method Detail
-
getNextChildLM
public LayoutManager getNextChildLM()
- Returns:
- layout manager of next child layout manager or null
-
getLM
protected LayoutManager getLM(java.lang.Object nextObj)
- Parameters:
nextObj
- next object from which to obtain position- Returns:
- layout manager
-
getPos
protected Position getPos(java.lang.Object nextObj)
Default implementation assumes that the passednextObj
is itself aPosition
, and just returns it. Subclasses for which this is not the case, must provide a suitable override this method.- Parameters:
nextObj
- next object from which to obtain position- Returns:
- position of next object.
-
lookAhead
private void lookAhead()
-
checkNext
protected boolean checkNext()
- Returns:
- true if not at end of sub-sequence with same child layout manager
-
endIter
protected void endIter()
end (reset) iterator
-
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interfacejava.util.Iterator<Position>
-
next
public Position next() throws java.util.NoSuchElementException
- Specified by:
next
in interfacejava.util.Iterator<Position>
- Throws:
java.util.NoSuchElementException
-
peekNext
public java.lang.Object peekNext()
- Returns:
- peek at next object
-
remove
public void remove() throws java.lang.UnsupportedOperationException
- Specified by:
remove
in interfacejava.util.Iterator<Position>
- Throws:
java.lang.UnsupportedOperationException
-
-