Package org.basex.query.value.seq
Class SingletonSeq
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.SingletonSeq
Sequence of a single item.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionlongatomSize()Computes the number of atomized items.atomValue(QueryContext qc, InputInfo ii) Evaluates the expression and returns the atomized items.voidCaches lazy values.Returns a string description of the expression.ebv(QueryContext qc, InputInfo ii) Checks if the effective boolean value can be computed for this expression:static ValueCreates a singleton sequence with the specified value.insert(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.voidCreates a query plan.voidplan(QueryString qs) Creates a query string.remove(long pos, QueryContext qc) Removes the item at the given position in this sequence and returns the resulting sequence.reverse(QueryContext qc) Returns all items of this value in reverse order.simplifyFor(CompileContext.Simplify mode, CompileContext cc) This function is called at compile time for expressions whose operands might be simplified.booleanIndicates if the sequence is based on a single item.protected SeqsubSeq(long offset, long length, QueryContext qc) Returns a sub sequence of this value with the given start and length.Methods inherited from class org.basex.query.value.seq.Seq
copyInsert, ddo, equals, get, hash, initialCapacity, insertBefore, item, iter, refineType, seqType, size, 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, data, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, 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
-
Method Details
-
ebv
Description copied from class:ExprChecks if the effective boolean value can be computed for this expression:
- If it yields an empty sequence,
Bln.FALSEwill be returned. - If it yields a single item, this item will be returned.
- If it yields nodes, the first node will be returned.
- Otherwise, an error will be raised.
A single numeric item may later be evaluated as positional predicate.
- Specified by:
ebvin classExpr- Parameters:
qc- query contextii- input info (required forSeqinstances, which have no input info)- Returns:
- item
- Throws:
QueryException- query exception
- If it yields an empty sequence,
-
cache
Description copied from class:ValueCaches lazy values.- Specified by:
cachein classValue- Parameters:
lazy- lazy cachingii- input info- Throws:
QueryException- query exception
-
atomValue
Description copied from class:ExprEvaluates the expression and returns the atomized items.- Specified by:
atomValuein classExpr- Parameters:
qc- query contextii- input info (only required bySeqinstances, which have no input info)- Returns:
- atomized item
- Throws:
QueryException- query exception
-
atomSize
public long atomSize()Description copied from class:ValueComputes the number of atomized items. -
subSeq
Description copied from class:SeqReturns a sub sequence of this value with the given start and length. -
insert
Description copied from class:SeqInserts an item at the given position into this sequence and returns the resulting sequence. -
remove
Description copied from class:SeqRemoves the item at the given position in this sequence and returns the resulting sequence. -
reverse
Description copied from class:ValueReturns all items of this value in reverse order. -
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. -
simplifyFor
Description copied from class:ExprThis function is called at compile time for expressions whose operands might be simplified.- Overrides:
simplifyForin classExpr- Parameters:
mode- mode of simplificationcc- compilation context- Returns:
- simplified or original expression
- Throws:
QueryException- query exception- See Also:
-
description
Description copied from class:ExprInfoReturns 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:
descriptionin classSeq- Returns:
- result of check
-
plan
Description copied from class:ExprInfoCreates a query plan. -
plan
Description copied from class:ExprInfoCreates a query string. -
singleItem
public boolean singleItem()Indicates if the sequence is based on a single item.- Returns:
- result of check
-
get
Creates a singleton sequence with the specified value.- Parameters:
value- valuecount- number of repetitions- Returns:
- value
-