Package org.basex.query.value.seq
Class DBNodes
java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.expr.Expr
org.basex.query.value.Value
org.basex.query.value.seq.Seq
org.basex.query.value.seq.DBNodeSeq
org.basex.query.value.seq.DBNodes
This class stores database nodes in an ascending order.
Instances of this class will be returned by the method
QueryProcessor.cache(int) method.
They are used in the GUI and in the Context class to reference currently opened,
marked, and copied database nodes.- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal longatomSize()Computes the number of atomized items.final voidCaches lazy values.booleancontains(int pre) Checks if the specified node is contained in the array.Returnsnullif the pre values reference all documents of the database.booleanThis function is e.g.intfind(int pre) Returns the position of the specified node or the negative value - 1 of the position where it should have been found.ftpos()Returns full-text position data.Assigns full-text position data.final Valueinsert(long pos, Item item, QueryContext qc) Inserts an item at the given position into this sequence and returns the resulting sequence.itemAt(long pos) Returns the item at the given position in the value.final Valueremove(long pos, QueryContext qc) Removes the item at the given position in this sequence and returns the resulting sequence.intsorted(int index) Returns a sorted pre value.voidtoggle(int pre) Adds or removes the specified pre node.voidunion(int[] pre) Merges the specified array with the existing pre nodes.Methods inherited from class org.basex.query.value.seq.DBNodeSeq
all, atomValue, data, ddo, ebv, get, get, get, plan, pre, pres, reverseMethods inherited from class org.basex.query.value.seq.Seq
copyInsert, description, get, hash, initialCapacity, insertBefore, item, iter, plan, refineType, seqType, size, subSeq, subsequence, test, toErrorString, toJavaMethods inherited from class org.basex.query.value.Value
accept, checkUp, compile, copy, count, exprSize, has, inline, inlineable, isEmpty, isItem, iter, iterator, materialize, serialize, serialize, serialize, valueMethods inherited from class org.basex.query.expr.Expr
arg, args, atomItem, atomIter, data, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, simplifyFor, typeCheck, uses, vacuous, visitAllMethods 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
-
DBNodes
Constructor, specifying a database and pre values.- Parameters:
data- data referencepres- pre values
-
DBNodes
Constructor, specifying a database, pre values and full-text positions.- Parameters:
all- pre values reference all documents of the databasedata- data referencepres- pre values
-
-
Method Details
-
ftpos
Assigns full-text position data.- Parameters:
ft- full-text positions- Returns:
- self reference
-
ftpos
Returns full-text position data.- Returns:
- position data
-
discardDocs
Returnsnullif the pre values reference all documents of the database.- Returns:
- self reference or
null
-
contains
public boolean contains(int pre) Checks if the specified node is contained in the array.- Parameters:
pre- pre value- Returns:
- true if the node was found
-
find
public int find(int pre) Returns the position of the specified node or the negative value - 1 of the position where it should have been found.- Parameters:
pre- pre value- Returns:
- position, or
-1
-
toggle
public void toggle(int pre) Adds or removes the specified pre node.- Parameters:
pre- pre value
-
union
public void union(int[] pre) Merges the specified array with the existing pre nodes.- Parameters:
pre- pre value
-
sorted
public int sorted(int index) Returns a sorted pre value.- Parameters:
index- index of pre value- Returns:
- pre value
-
itemAt
Description copied from class:ValueReturns the item at the given position in the value. The specified value must be lie within the valid bounds. -
equals
Description copied from class:ExprThis function is e.g. called by:If.optimize(CompileContext),Switch.optimize(CompileContext),Typeswitch.optimize(CompileContext), in order to discard identical expressions.CmpR.mergeEbv(Expr, boolean, CompileContext)orCmpSR.mergeEbv(Expr, boolean, CompileContext), in order to merge expressions with identical input.CmpG.optimize(CompileContext)orCmpV.optimize(CompileContext), in order to pre-evaluate equality tests.CmpG.optimize(CompileContext)orPos.get(Expr, CmpV.OpV, InputInfo, CompileContext), in order to compare the start and end value.PathCache, in order to find identical root values at runtime.
-
cache
Description copied from class:ValueCaches lazy values. -
atomSize
public final long atomSize()Description copied from class:ValueComputes the number of atomized items. -
insert
Inserts an item at the given position into this sequence and returns the resulting sequence. Because this function will mostly be invoked recursively, the standard implementation will be called, because its runtime outweighs the possibly higher memory consumption. -
remove
Removes the item at the given position in this sequence and returns the resulting sequence. Because this function will mostly be invoked recursively, the standard implementation will be called, because its runtime outweighs the possibly higher memory consumption.
-