Package org.apache.fop.fo
Class RecursiveCharIterator
- java.lang.Object
-
- org.apache.fop.fo.CharIterator
-
- org.apache.fop.fo.RecursiveCharIterator
-
- All Implemented Interfaces:
java.lang.Cloneable
,java.util.Iterator
public class RecursiveCharIterator extends CharIterator
Kind of a super-iterator that iterates through child nodes of an FONode, in turn managing character iterators for each of them. Caveat: Because this class is itself a CharIterator, and manages a collection of CharIterators, it is easy to get confused.
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Iterator
childIter
iterator for the child nodesprivate CharIterator
curCharIter
CharIterator for curChild's charactersprivate FONode
curChild
current child object that is being managed by childIterprivate FONode
fobj
parent node for whose child nodes this iterator iterates
-
Constructor Summary
Constructors Constructor Description RecursiveCharIterator(FObj fobj)
Constructor which creates an iterator for all child nodesRecursiveCharIterator(FObj fobj, FONode child)
Constructor which creates an iterator for only some child nodes
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Object
clone()
private void
getNextCharIter()
advances curChild to the next child in the collection, and curCharIter to the CharIterator for that item, or sets them to null if the iterator has no more itemsboolean
hasNext()
CharIterator
mark()
char
nextChar()
void
remove()
void
replaceChar(char c)
Replaces the current character in the CharIterator with a specified character-
Methods inherited from class org.apache.fop.fo.CharIterator
next
-
-
-
-
Field Detail
-
fobj
private FONode fobj
parent node for whose child nodes this iterator iterates
-
childIter
private java.util.Iterator childIter
iterator for the child nodes
-
curChild
private FONode curChild
current child object that is being managed by childIter
-
curCharIter
private CharIterator curCharIter
CharIterator for curChild's characters
-
-
Constructor Detail
-
RecursiveCharIterator
public RecursiveCharIterator(FObj fobj)
Constructor which creates an iterator for all child nodes- Parameters:
fobj
- FONode for which an iterator should be created
-
-
Method Detail
-
mark
public CharIterator mark()
- Returns:
- clone of this, cast as a CharIterator
-
clone
public java.lang.Object clone()
Description copied from class:CharIterator
- Overrides:
clone
in classCharIterator
- Returns:
- a clone of this
-
replaceChar
public void replaceChar(char c)
Replaces the current character in the CharIterator with a specified character- Overrides:
replaceChar
in classCharIterator
- Parameters:
c
- the character which should be used to replace the current character
-
getNextCharIter
private void getNextCharIter()
advances curChild to the next child in the collection, and curCharIter to the CharIterator for that item, or sets them to null if the iterator has no more items
-
hasNext
public boolean hasNext()
Description copied from class:CharIterator
- Specified by:
hasNext
in interfacejava.util.Iterator
- Specified by:
hasNext
in classCharIterator
- Returns:
- true if there are more items in the CharIterator
-
nextChar
public char nextChar() throws java.util.NoSuchElementException
- Specified by:
nextChar
in classCharIterator
- Returns:
- the character that is the next character in the collection
- Throws:
java.util.NoSuchElementException
- if there are no more characters (test for this condition with java.util.Iterator.hasNext()).
-
remove
public void remove()
- Specified by:
remove
in interfacejava.util.Iterator
- Overrides:
remove
in classCharIterator
-
-