Package com.itextpdf.xmp.impl
Class XMPIteratorImpl.NodeIterator
- java.lang.Object
-
- com.itextpdf.xmp.impl.XMPIteratorImpl.NodeIterator
-
- All Implemented Interfaces:
java.util.Iterator
- Direct Known Subclasses:
XMPIteratorImpl.NodeIteratorChildren
- Enclosing class:
- XMPIteratorImpl
private class XMPIteratorImpl.NodeIterator extends java.lang.Object implements java.util.Iterator
TheXMPIterator
implementation. It first returns the node itself, then recursivly the children and qualifier of the node.- Since:
- 29.06.2006
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Iterator
childrenIterator
the iterator that goes through the children and qualifier listprivate int
index
index of node with parent, only interesting for arraysprotected static int
ITERATE_CHILDREN
iteration stateprotected static int
ITERATE_NODE
iteration stateprotected static int
ITERATE_QUALIFIER
iteration stateprivate java.lang.String
path
the recursively accumulated pathprivate XMPPropertyInfo
returnProperty
the cachedPropertyInfo
to returnprivate int
state
the state of the iterationprivate java.util.Iterator
subIterator
the iterator for each childprivate XMPNode
visitedNode
the currently visited node
-
Constructor Summary
Constructors Constructor Description NodeIterator()
Default constructorNodeIterator(XMPNode visitedNode, java.lang.String parentPath, int index)
Constructor for the node iterator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.String
accumulatePath(XMPNode currNode, java.lang.String parentPath, int currentIndex)
protected XMPPropertyInfo
createPropertyInfo(XMPNode node, java.lang.String baseNS, java.lang.String path)
Creates a property info object from anXMPNode
.protected java.util.Iterator
getChildrenIterator()
protected XMPPropertyInfo
getReturnProperty()
boolean
hasNext()
Prepares the next node to return if not already done.private boolean
iterateChildren(java.util.Iterator iterator)
Handles the iteration of the children or qualfierjava.lang.Object
next()
Calls hasNext() and returnes the prepared node.void
remove()
Not supported.protected boolean
reportNode()
Sets the returnProperty as next item or recurses intohasNext()
.protected void
setChildrenIterator(java.util.Iterator childrenIterator)
protected void
setReturnProperty(XMPPropertyInfo returnProperty)
-
-
-
Field Detail
-
ITERATE_NODE
protected static final int ITERATE_NODE
iteration state- See Also:
- Constant Field Values
-
ITERATE_CHILDREN
protected static final int ITERATE_CHILDREN
iteration state- See Also:
- Constant Field Values
-
ITERATE_QUALIFIER
protected static final int ITERATE_QUALIFIER
iteration state- See Also:
- Constant Field Values
-
state
private int state
the state of the iteration
-
visitedNode
private XMPNode visitedNode
the currently visited node
-
path
private java.lang.String path
the recursively accumulated path
-
childrenIterator
private java.util.Iterator childrenIterator
the iterator that goes through the children and qualifier list
-
index
private int index
index of node with parent, only interesting for arrays
-
subIterator
private java.util.Iterator subIterator
the iterator for each child
-
returnProperty
private XMPPropertyInfo returnProperty
the cachedPropertyInfo
to return
-
-
Constructor Detail
-
NodeIterator
public NodeIterator()
Default constructor
-
NodeIterator
public NodeIterator(XMPNode visitedNode, java.lang.String parentPath, int index)
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 Detail
-
hasNext
public boolean hasNext()
Prepares the next node to return if not already done.- Specified by:
hasNext
in interfacejava.util.Iterator
- See Also:
Iterator.hasNext()
-
reportNode
protected boolean reportNode()
Sets the returnProperty as next item or recurses intohasNext()
.- Returns:
- Returns if there is a next item to return.
-
iterateChildren
private boolean iterateChildren(java.util.Iterator iterator)
Handles the iteration of the children or qualfier- Parameters:
iterator
- an iterator- Returns:
- Returns if there are more elements available.
-
next
public java.lang.Object 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.- Specified by:
next
in interfacejava.util.Iterator
- See Also:
Iterator.next()
-
remove
public void remove()
Not supported.- Specified by:
remove
in interfacejava.util.Iterator
- See Also:
Iterator.remove()
-
accumulatePath
protected java.lang.String accumulatePath(XMPNode currNode, java.lang.String parentPath, int currentIndex)
- 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
protected XMPPropertyInfo createPropertyInfo(XMPNode node, java.lang.String baseNS, java.lang.String path)
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
protected java.util.Iterator getChildrenIterator()
- Returns:
- the childrenIterator
-
setChildrenIterator
protected void setChildrenIterator(java.util.Iterator childrenIterator)
- Parameters:
childrenIterator
- the childrenIterator to set
-
getReturnProperty
protected XMPPropertyInfo getReturnProperty()
- Returns:
- Returns the returnProperty.
-
setReturnProperty
protected void setReturnProperty(XMPPropertyInfo returnProperty)
- Parameters:
returnProperty
- the returnProperty to set
-
-