Class NodeIteratorImpl
- java.lang.Object
-
- org.apache.jackrabbit.jcr2spi.query.NodeIteratorImpl
-
- All Implemented Interfaces:
Iterator,NodeIterator,RangeIterator,ScoreNodeIterator
public class NodeIteratorImpl extends Object implements ScoreNodeIterator
Implements aNodeIteratorreturned byQueryResult.getNodes().
-
-
Constructor Summary
Constructors Constructor Description NodeIteratorImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr, QueryInfo queryInfo)Creates a newNodeIteratorImplinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetPosition()Returns the current position in thisNodeIterator.doublegetScore()Returns the score of the node returned bynextNode().longgetSize()Returns the number of nodes in this iterator.booleanhasNext()Returnstrueif there is anotherNodeavailable;falseotherwise.Objectnext()Returns the nextNodein the result set.NodenextNode()Returns the nextNodein the result set.voidremove()voidskip(long skipNum)Skip a number ofNodes in this iterator.-
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
-
-
-
-
Constructor Detail
-
NodeIteratorImpl
public NodeIteratorImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr, QueryInfo queryInfo)
Creates a newNodeIteratorImplinstance.- Parameters:
itemMgr- TheItemManagerto buildNodeinstances.hierarchyMgr- TheHierarchyManagerused to retrieve the HierarchyEntry objects from the ids returned by the query.queryInfo- the query result.
-
-
Method Detail
-
getScore
public double getScore() throws NoSuchElementExceptionReturns the score of the node returned bynextNode(). In other words, this method returns the score value of the nextNode.- Specified by:
getScorein interfaceScoreNodeIterator- Returns:
- the score of the node returned by
nextNode(). - Throws:
NoSuchElementException- if there is no next node.- See Also:
ScoreNodeIterator.getScore()
-
nextNode
public Node nextNode() throws NoSuchElementException
Returns the nextNodein the result set.- Specified by:
nextNodein interfaceNodeIterator- Returns:
- the next
Nodein the result set. - Throws:
NoSuchElementException- if iteration has no moreNodes.- See Also:
NodeIterator.nextNode()
-
skip
public void skip(long skipNum) throws NoSuchElementExceptionSkip a number ofNodes in this iterator.- Specified by:
skipin interfaceRangeIterator- Parameters:
skipNum- the non-negative number ofNodes to skip- Throws:
NoSuchElementException- if skipped past the lastNodein this iterator.- See Also:
RangeIterator.skip(long)
-
getSize
public long getSize()
Returns the number of nodes in this iterator.Note: The number returned by this method may differ from the number of nodes actually returned by calls to hasNext() / getNextNode()! This is because this iterator works on a lazy instantiation basis and while iterating over the nodes some of them might have been deleted in the meantime. Those will not be returned by getNextNode(). As soon as an invalid node is detected, the size of this iterator is adjusted.
- Specified by:
getSizein interfaceRangeIterator- Returns:
- the number of node in this iterator.
- See Also:
RangeIterator.getSize()
-
getPosition
public long getPosition()
Returns the current position in thisNodeIterator.- Specified by:
getPositionin interfaceRangeIterator- Returns:
- the current position in this
NodeIterator. - See Also:
RangeIterator.getPosition()
-
next
public Object next() throws NoSuchElementException
Returns the nextNodein the result set.- Specified by:
nextin interfaceIterator- Returns:
- the next
Nodein the result set. - Throws:
NoSuchElementException- if iteration has no moreNodes.- See Also:
Iterator.next()
-
hasNext
public boolean hasNext()
Returnstrueif there is anotherNodeavailable;falseotherwise.- Specified by:
hasNextin interfaceIterator- Returns:
trueif there is anotherNodeavailable;falseotherwise.- See Also:
Iterator.hasNext()
-
remove
public void remove()
- Specified by:
removein interfaceIterator- Throws:
UnsupportedOperationException- always.- See Also:
Iterator.remove()
-
-