Package org.basex.query.util.list
Class ANodeBuilder
Resizable-array implementation for nodes. The stored nodes will be sorted and duplicates will
before removed before they are returned as value or via an iterator.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.util.list.ObjectList
listFields inherited from class org.basex.util.list.ElementList
factor, size -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an element to the array.intbinarySearch(DBNode node, int start, int length) Performs a binary search on the given range of this sequence iterator.booleanChecks if the specified element is found in the list.data()Returns the shared database.voidddo()Sorts the nodes and removes distinct nodes.booleanbooleanCompares two list elements.iterator()protected ANode[]newArray(int s) Creates a resized array.booleanRemoves all occurrences of the specified element from the list.Returns a value with the type of the given expression and invalidates the internal array.Methods inherited from class org.basex.util.list.ObjectList
add, add, addUnique, finish, get, insert, next, peek, pop, push, remove, removeAll, set, sort, toArray, toString, uniqueMethods inherited from class org.basex.util.list.ElementList
isEmpty, newCapacity, newCapacity, reset, size, sizeMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
ANodeBuilder
public ANodeBuilder()Constructor.
-
-
Method Details
-
add
Description copied from class:ObjectListAdds an element to the array.- Overrides:
addin classObjectList<ANode,ANodeBuilder> - Parameters:
node- element to be added- Returns:
- self reference
-
value
Returns a value with the type of the given expression and invalidates the internal array. Warning: the function must only be called if the builder is discarded afterwards.- Parameters:
expr- expression- Returns:
- the iterator
-
ddo
public void ddo()Sorts the nodes and removes distinct nodes. -
data
Returns the shared database.- Returns:
- database or
null
-
removeAll
Description copied from class:ObjectListRemoves all occurrences of the specified element from the list.- Overrides:
removeAllin classObjectList<ANode,ANodeBuilder> - Parameters:
node- element to be removed- Returns:
- flag, indicating if any element was removed
-
contains
Description copied from class:ObjectListChecks if the specified element is found in the list.- Overrides:
containsin classObjectList<ANode,ANodeBuilder> - Parameters:
node- element to be found- Returns:
- result of check
-
binarySearch
Performs a binary search on the given range of this sequence iterator. This works ifdatais assigned.- Parameters:
node- node to findstart- start of the search intervallength- length of the search interval- Returns:
- position of the item or
-insertPosition - 1if not found
-
iterator
- Specified by:
iteratorin interfaceIterable<ANode>- Overrides:
iteratorin classObjectList<ANode,ANodeBuilder>
-
newArray
Description copied from class:ObjectListCreates a resized array.- Specified by:
newArrayin classObjectList<ANode,ANodeBuilder> - Parameters:
s- size- Returns:
- array
-
equals
Description copied from class:ObjectListCompares two list elements.- Overrides:
equalsin classObjectList<ANode,ANodeBuilder> - Parameters:
node1- first elementnode2- second element- Returns:
- result of check
-
equals
- Overrides:
equalsin classObjectList<ANode,ANodeBuilder>
-