Package com.itextpdf.kernel.xmp.impl
Class XMPIteratorImpl.NodeIterator
java.lang.Object
com.itextpdf.kernel.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 Iterator
the iterator that goes through the children and qualifier listprivate int
index of node with parent, only interesting for arraysprotected static final int
iteration stateprotected static final int
iteration stateprotected static final int
iteration stateprivate String
the recursively accumulated pathprivate XMPPropertyInfo
the cachedPropertyInfo
to returnprivate int
the state of the iterationprivate Iterator
the iterator for each childprivate XMPNode
the currently visited node -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructorNodeIterator
(XMPNode visitedNode, String parentPath, int index) Constructor for the node iterator. -
Method Summary
Modifier and TypeMethodDescriptionprotected String
accumulatePath
(XMPNode currNode, String parentPath, int currentIndex) protected XMPPropertyInfo
createPropertyInfo
(XMPNode node, String baseNS, String path) Creates a property info object from anXMPNode
.protected Iterator
protected XMPPropertyInfo
boolean
hasNext()
Prepares the next node to return if not already done.private boolean
iterateChildren
(Iterator iterator) Handles the iteration of the children or qualfiernext()
Calls hasNext() and returnes the prepared node.void
remove()
Not supported.protected boolean
Sets the returnProperty as next item or recurses intohasNext()
.protected void
setChildrenIterator
(Iterator childrenIterator) protected void
setReturnProperty
(XMPPropertyInfo returnProperty) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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 cachedPropertyInfo
to 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
- anXMPNode
baseNS
- 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
-