Package com.itextpdf.xmp.impl
Class XMPIteratorImpl.NodeIterator
java.lang.Object
com.itextpdf.xmp.impl.XMPIteratorImpl.NodeIterator
- All Implemented Interfaces:
Iterator
- Direct Known Subclasses:
XMPIteratorImpl.NodeIteratorChildren
- Enclosing class:
XMPIteratorImpl
The
XMPIterator implementation.
It first returns the node itself, then recursivly the children and qualifier of the node.- Since:
- 29.06.2006
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Iteratorthe iterator that goes through the children and qualifier listprivate intindex of node with parent, only interesting for arraysprotected static final intiteration stateprotected static final intiteration stateprotected static final intiteration stateprivate Stringthe recursively accumulated pathprivate XMPPropertyInfothe cachedPropertyInfoto returnprivate intthe state of the iterationprivate Iteratorthe iterator for each childprivate XMPNodethe currently visited node -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorNodeIterator(XMPNode visitedNode, String parentPath, int index) Constructor for the node iterator. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaccumulatePath(XMPNode currNode, String parentPath, int currentIndex) protected XMPPropertyInfocreatePropertyInfo(XMPNode node, String baseNS, String path) Creates a property info object from anXMPNode.protected Iteratorprotected XMPPropertyInfobooleanhasNext()Prepares the next node to return if not already done.private booleaniterateChildren(Iterator iterator) Handles the iteration of the children or qualfiernext()Calls hasNext() and returnes the prepared node.voidremove()Not supported.protected booleanSets the returnProperty as next item or recurses intohasNext().protected voidsetChildrenIterator(Iterator childrenIterator) protected voidsetReturnProperty(XMPPropertyInfo returnProperty) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
Field Details
-
ITERATE_NODE
protected static final int ITERATE_NODEiteration state- See Also:
-
ITERATE_CHILDREN
protected static final int ITERATE_CHILDRENiteration state- See Also:
-
ITERATE_QUALIFIER
protected static final int ITERATE_QUALIFIERiteration state- See Also:
-
state
private int statethe state of the iteration -
visitedNode
the currently visited node -
path
the recursively accumulated path -
childrenIterator
the iterator that goes through the children and qualifier list -
index
private int indexindex of node with parent, only interesting for arrays -
subIterator
the iterator for each child -
returnProperty
the cachedPropertyInfoto return
-
-
Constructor Details
-
NodeIterator
public NodeIterator()Default constructor -
NodeIterator
Constructor for the node iterator.- Parameters:
visitedNode- the currently visited nodeparentPath- the accumulated path of the nodeindex- the index within the parent node (only for arrays)
-
-
Method Details
-
hasNext
public boolean hasNext()Prepares the next node to return if not already done. -
reportNode
protected boolean reportNode()Sets the returnProperty as next item or recurses intohasNext().- Returns:
- Returns if there is a next item to return.
-
iterateChildren
Handles the iteration of the children or qualfier- Parameters:
iterator- an iterator- Returns:
- Returns if there are more elements available.
-
next
Calls hasNext() and returnes the prepared node. Afterwards its set to null. The existance of returnProperty indicates if there is a next node, otherwise an exceptio is thrown. -
remove
public void remove()Not supported. -
accumulatePath
- Parameters:
currNode- the node that will be added to the path.parentPath- the path up to this node.currentIndex- the current array index if an arrey is traversed- Returns:
- Returns the updated path.
-
createPropertyInfo
Creates a property info object from anXMPNode.- Parameters:
node- anXMPNodebaseNS- the base namespace to reportpath- the full property path- Returns:
- Returns a
XMPProperty-object that serves representation of the node.
-
getChildrenIterator
- Returns:
- the childrenIterator
-
setChildrenIterator
- Parameters:
childrenIterator- the childrenIterator to set
-
getReturnProperty
- Returns:
- Returns the returnProperty.
-
setReturnProperty
- Parameters:
returnProperty- the returnProperty to set
-