|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.query.iter.Iter
org.basex.query.iter.NodeIter
org.basex.query.iter.AxisIter
org.basex.query.iter.NodeSeqBuilder
public final class NodeSeqBuilder
This class can be used to build new node sequences. At the same time, it serves as an iterator.
Field Summary | |
---|---|
ANode[] |
nodes
Node container. |
Constructor Summary | |
---|---|
NodeSeqBuilder()
Constructor. |
|
NodeSeqBuilder(ANode[] it,
int s)
Lightweight constructor, assigning the specified array of sorted nodes. |
Method Summary | |
---|---|
void |
add(ANode n)
Adds a node. |
int |
binarySearch(DBNode n,
int start,
int length)
Performs a binary search on the given range of this sequence iterator, assuming that all nodes are DBNode s from the same Data
instance (i.e., dbnodes() returns true ). |
NodeSeqBuilder |
check()
Checks all nodes for potential duplicates and their orderedness. |
NodeSeqBuilder |
copy()
Creates a copy of this sequence builder. |
boolean |
dbnodes()
Checks if binary search can be applied to this iterator, i.e. |
void |
delete(int p)
Deletes a value at the specified position. |
ANode |
get(int i)
Returns the specified node. |
ANode |
get(long i)
Returns the specified item, or an arbitrary item if the index is invalid. |
int |
indexOf(ANode n,
boolean db)
Checks if the iterator contains a database node with the specified pre value. |
ANode |
next()
Returns the next item or null if no other items are found. |
boolean |
reset()
Resets the iterator and returns true if operation was successful. |
long |
size()
Returns the iterator size. |
void |
size(int s)
Sets a new item size. |
NodeSeqBuilder |
sort()
Sorts the nodes, if necessary. |
java.lang.String |
toString()
|
Value |
value()
Returns a sequence with all iterator values. |
Methods inherited from class org.basex.query.iter.AxisIter |
---|
iterator |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public ANode[] nodes
Constructor Detail |
---|
public NodeSeqBuilder()
public NodeSeqBuilder(ANode[] it, int s)
it
- node arrays
- sizeMethod Detail |
---|
public NodeSeqBuilder check()
public ANode get(int i)
i
- node offset
public void delete(int p)
p
- deletion positionpublic void add(ANode n)
n
- node to be addedpublic boolean reset()
Iter
true
if operation was successful.
false
is returned if the iterator cannot be reset.
reset
in class Iter
public ANode next()
Iter
null
if no other items are found.
next
in class AxisIter
null
public ANode get(long i)
Iter
Iter.size()
returns the correct number of results. A calling method
should call Iter.reset()
after the last items has been retrieved.
get
in class Iter
i
- value offset
public long size()
Iter
-1
is returned if the
result size is unknown. If this method is implemented by an iterator,
Iter.get(long)
needs to be implemented as well.
size
in class Iter
public void size(int s)
s
- sizepublic Value value()
Iter
Iter.next()
has not been called before.
value
in class Iter
public boolean dbnodes()
DBNode
references and refer to the same database.
public int indexOf(ANode n, boolean db)
n
- node to be founddb
- indicates if all nodes are sorted DBNode
references
-1
public int binarySearch(DBNode n, int start, int length)
DBNode
s from the same Data
instance (i.e., dbnodes()
returns true
).
n
- node to findstart
- start of the search intervallength
- length of the search interval
-insertPosition - 1
if not foundpublic NodeSeqBuilder sort()
public java.lang.String toString()
toString
in class java.lang.Object
public NodeSeqBuilder copy()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |