Package org.basex.query.value.seq
Class RangeSeq
- 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.RangeSeq
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
ascending()
Returns whether the order is ascending or descending.Value
atomValue(QueryContext qc, InputInfo ii)
Evaluates the expression and returns the atomized items.void
cache(boolean lazy, InputInfo ii)
Caches lazy values.String
description()
Returns a string description of the expression.boolean
equals(Object obj)
This function is e.g.static Value
get(long start, long size, boolean ascending)
Returns a value representation of the specified items.Value
insertBefore(long pos, Item item, QueryContext qc)
Inserts an item at the given position into this sequence and returns the resulting sequence.Int
itemAt(long pos)
Returns the item at the given position in the value.boolean
materialized(Predicate<Data> test, InputInfo ii)
Checks if this value is materialized, i.e., contains no persistent database nodes or function items.long
max()
Returns the maximum value, ignoring the order.long
min()
Returns the minimum value, ignoring the order.Expr
optimizePos(CmpV.OpV op, CompileContext cc)
Optimizes an expression for positional access.static Value
read(DataInput in, Type type, QueryContext qc)
Creates a value from the input stream.void
refineType()
Computes a more precise sequence type of this value.Value
remove(long pos, QueryContext qc)
Removes the item at the given position in this sequence and returns the resulting sequence.Value
reverse(QueryContext qc)
Returns all items of this value in reverse order.boolean
sameType()
Checks if all items of the sequence are of the same type.protected Seq
subSeq(long pos, long length, QueryContext qc)
Returns a subsequence of this value with the given start and length.boolean
test(QueryContext qc, InputInfo ii, long pos)
Computes the effective boolean value for this expression.Object
toJava()
Returns a Java representation of the value.void
toString(QueryString qs)
Creates a query string.void
toXml(QueryPlan plan)
Creates a query plan.void
write(DataOutput out)
Writes the data structure to disk.-
Methods inherited from class org.basex.query.value.seq.Seq
copyInsert, ddo, get, initialCapacity, insert, item, iter, materialize, refineType, seqType, simplifyFor, size, subsequence, toErrorString
-
Methods inherited from class org.basex.query.value.Value
accept, checkUp, compile, copy, count, exprSize, has, inline, inlineable, isEmpty, isItem, iter, iterator, refineType, serialize, serialize, serialize, value
-
Methods inherited from class org.basex.query.expr.Expr
arg, args, atomItem, atomIter, data, funcType, hasFreeVars, indexAccessible, info, isSimple, markTailCalls, mergeEbv, optimize, simplify, typeCheck, uses, vacuous, visitAll
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
get
public static Value get(long start, long size, boolean ascending)
Returns a value representation of the specified items.- Parameters:
start
- start valuesize
- sizeascending
- ascending order- Returns:
- resulting item or sequence
-
read
public static Value read(DataInput in, Type type, QueryContext qc) throws IOException
Creates a value from the input stream. Called fromStore.read(DataInput, QueryContext)
.- Parameters:
in
- data inputtype
- typeqc
- query context- Returns:
- value
- Throws:
IOException
- I/O exception
-
write
public void write(DataOutput out) throws IOException
Description copied from class:Value
Writes the data structure to disk.- Overrides:
write
in classValue
- Parameters:
out
- data output- Throws:
IOException
- I/O exception
-
ascending
public boolean ascending()
Returns whether the order is ascending or descending.- Returns:
- order
-
min
public long min()
Returns the minimum value, ignoring the order.- Returns:
- minimum value
-
max
public long max()
Returns the maximum value, ignoring the order.- Returns:
- maximum value
-
test
public boolean test(QueryContext qc, InputInfo ii, long pos) throws QueryException
Description copied from class:Expr
Computes the effective boolean value for this expression.- Overrides:
test
in classSeq
- Parameters:
qc
- query contextii
- input info (can benull
); required for thoseValue
instances that have no input info)pos
- position of context item (if0
, perform EBV test)- Returns:
- item
- Throws:
QueryException
- query exception
-
toJava
public Object toJava()
Description copied from class:Value
Returns a Java representation of the value.
-
itemAt
public Int itemAt(long pos)
Description copied from class:Value
Returns the item at the given position in the value. The specified value must be lie within the valid bounds.
-
subSeq
protected Seq subSeq(long pos, long length, QueryContext qc)
Description copied from class:Seq
Returns a subsequence of this value with the given start and length.
-
insertBefore
public Value insertBefore(long pos, Item item, QueryContext qc)
Description copied from class:Seq
Inserts an item at the given position into this sequence and returns the resulting sequence.- Specified by:
insertBefore
in classSeq
- Parameters:
pos
- position at which the item should be inserted, must be between 0 andSeq.size
item
- item to insertqc
- query context- Returns:
- resulting value
-
remove
public Value remove(long pos, QueryContext qc)
Description copied from class:Seq
Removes the item at the given position in this sequence and returns the resulting sequence.
-
reverse
public Value reverse(QueryContext qc)
Description copied from class:Value
Returns all items of this value in reverse order.
-
cache
public void cache(boolean lazy, InputInfo ii)
Description copied from class:Value
Caches lazy values.
-
atomValue
public Value atomValue(QueryContext qc, InputInfo ii)
Description copied from class:Expr
Evaluates the expression and returns the atomized items.
-
sameType
public boolean sameType()
Description copied from class:Value
Checks if all items of the sequence are of the same type.
-
materialized
public boolean materialized(Predicate<Data> test, InputInfo ii)
Description copied from class:Value
Checks if this value is materialized, i.e., contains no persistent database nodes or function items.- Overrides:
materialized
in classSeq
- Parameters:
test
- check if a contained node can be adopted unchangedii
- input info (can benull
)- Returns:
- result of check
-
optimizePos
public Expr optimizePos(CmpV.OpV op, CompileContext cc)
Description copied from class:Expr
- Overrides:
optimizePos
in classExpr
- Parameters:
op
- comparison operatorcc
- compilation context- Returns:
- boolean result, optimized or original expression
-
equals
public boolean equals(Object obj)
Description copied from class:Expr
This 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)
, in order to compare the start and end value.PathCache
, in order to find identical root values at runtime.
-
refineType
public void refineType()
Description copied from class:Value
Computes a more precise sequence type of this value.- Overrides:
refineType
in classValue
-
description
public String description()
Description copied from class:ExprInfo
Returns a string description of the expression. This method is only called by error messages. Contrary to theExprInfo.toString()
method, arguments are not included in the output.- Overrides:
description
in classSeq
- Returns:
- result of check
-
toXml
public void toXml(QueryPlan plan)
Description copied from class:ExprInfo
Creates a query plan.
-
toString
public void toString(QueryString qs)
Description copied from class:ExprInfo
Creates a query string.
-
-