public class NodeIteratorImpl extends Object implements ScoreNodeIterator
NodeIterator
returned by
QueryResult.getNodes()
.Constructor and Description |
---|
NodeIteratorImpl(ItemManager itemMgr,
HierarchyManager hierarchyMgr,
QueryInfo queryInfo)
Creates a new
NodeIteratorImpl instance. |
Modifier and Type | Method and Description |
---|---|
long |
getPosition()
Returns the current position in this
NodeIterator . |
double |
getScore()
Returns the score of the node returned by
nextNode() . |
long |
getSize()
Returns the number of nodes in this iterator.
|
boolean |
hasNext()
Returns
true if there is another Node
available; false otherwise. |
Object |
next()
Returns the next
Node in the result set. |
Node |
nextNode()
Returns the next
Node in the result set. |
void |
remove() |
void |
skip(long skipNum)
Skip a number of
Node s in this iterator. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachRemaining
public NodeIteratorImpl(ItemManager itemMgr, HierarchyManager hierarchyMgr, QueryInfo queryInfo)
NodeIteratorImpl
instance.itemMgr
- The ItemManager
to build Node
instances.hierarchyMgr
- The HierarchyManager
used to retrieve the
HierarchyEntry objects from the ids returned by the query.queryInfo
- the query result.public double getScore() throws NoSuchElementException
nextNode()
. In other
words, this method returns the score value of the next Node
.getScore
in interface ScoreNodeIterator
nextNode()
.NoSuchElementException
- if there is no next node.ScoreNodeIterator.getScore()
public Node nextNode() throws NoSuchElementException
Node
in the result set.nextNode
in interface NodeIterator
Node
in the result set.NoSuchElementException
- if iteration has no more Node
s.NodeIterator.nextNode()
public void skip(long skipNum) throws NoSuchElementException
Node
s in this iterator.skip
in interface RangeIterator
skipNum
- the non-negative number of Node
s to skipNoSuchElementException
- if skipped past the last Node
in this iterator.RangeIterator.skip(long)
public long getSize()
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.
getSize
in interface RangeIterator
RangeIterator.getSize()
public long getPosition()
NodeIterator
.getPosition
in interface RangeIterator
NodeIterator
.RangeIterator.getPosition()
public Object next() throws NoSuchElementException
Node
in the result set.next
in interface Iterator
Node
in the result set.NoSuchElementException
- if iteration has no more Node
s.Iterator.next()
public boolean hasNext()
true
if there is another Node
available; false
otherwise.hasNext
in interface Iterator
true
if there is another Node
available; false
otherwise.Iterator.hasNext()
public void remove()
remove
in interface Iterator
UnsupportedOperationException
- always.Iterator.remove()
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.