Package org.basex.query.value.item
Class Item
java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.expr.Expr
org.basex.query.value.Value
org.basex.query.value.item.Item
Abstract super class for all items.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatomItem(QueryContext qc, InputInfo ii) Evaluates the expression and returns the resulting, atomized item, orEmpty.VALUEif the expression yields an empty sequence.longatomSize()Computes the number of atomized items.atomValue(QueryContext qc, InputInfo ii) Evaluates the expression and returns the atomized items.booleanReturns a boolean representation of the value.voidCaches lazy values.booleancomparable(Item item) Checks if the items can be compared.doubleReturns a double representation of the value.booleanddo()Indicates if this expression returns nodes in document order without duplicates.Returns a decimal representation of the value.Returns a string description of the expression.intReturns the difference between the current and the specified item.ebv(QueryContext qc, InputInfo ii) Checks if the effective boolean value can be computed for this expression:abstract booleaneq(Item item, Collation coll, StaticContext sc, InputInfo ii) Compares the items for equality.final booleanCompares the items for equivalence.floatReturns a float representation of the value.intReturns a hash code for this value.Returns an input stream.booleaninstanceOf(Type tp) Checks if this item is instance of the specified type.final Itemitem(QueryContext qc, InputInfo ii) Evaluates the expression and returns the resulting item, orEmpty.VALUEif the expression yields an empty sequence.final ItemitemAt(long pos) Returns the item at the given position in the value.iter()Returns an iterator.longReturns an integer (long) representation of the value.materialize(QueryContext qc, boolean copy) Returns a materialized, context-independent version of this item.final booleanIndicates if this item references a persistent database.voidCreates a query plan.voidrefineType(Expr expr) Refines the expression type.final Itemreverse(QueryContext qc) Returns all items of this value in reverse order.booleanCompares the items for equality.doublescore()Returns a score value.seqType()Returns the static type of the resulting value.longsize()Returns the result size, or-1if the size is unknown.abstract byte[]Returns a string representation of the value.subsequence(long start, long length, QueryContext qc) Returns a subsequence of this value with the given start and length.test(QueryContext qc, InputInfo ii) Performs a predicate test and returns the item if the test was successful.typeId()Returns a type id.byte[]xdmInfo()Returns data model info.Methods 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, toJava, valueMethods inherited from class org.basex.query.expr.Expr
arg, args, atomIter, data, data, equals, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, simplifyFor, typeCheck, uses, vacuous, visitAllMethods inherited from class org.basex.query.expr.ExprInfo
plan, toErrorString, toStringMethods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
UNDEF
public static final int UNDEFUndefined item.- See Also:
-
-
Constructor Details
-
Item
Constructor.- Parameters:
type- item type
-
-
Method Details
-
iter
Description copied from class:ValueReturns an iterator. -
item
Description copied from class:ExprEvaluates the expression and returns the resulting item, orEmpty.VALUEif the expression yields an empty sequence. If this method is not implemented,Expr.value(QueryContext)must be implemented instead.- Specified by:
itemin classExpr- Parameters:
qc- query contextii- input info (only required bySeqinstances, which have no input info)- Returns:
- item or
Empty.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. -
reverse
Description copied from class:ValueReturns all items of this value in reverse order. -
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.
- If it yields an empty sequence,
-
test
Description copied from class:ExprPerforms a predicate test and returns the item if the test was successful. The returned item is required for full-text scoring.- Specified by:
testin classExpr- Parameters:
qc- query contextii- input info (required forSeqinstances, which have no input info)- Returns:
- item or
null - Throws:
QueryException- query exception
-
string
Returns a string representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- string value
- Throws:
QueryException- if the item cannot be atomized (caused by function or streaming items)
-
bool
Returns a boolean representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- boolean value
- Throws:
QueryException- query exception
-
dec
Returns a decimal representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- decimal value
- Throws:
QueryException- query exception
-
itr
Returns an integer (long) representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- long value
- Throws:
QueryException- query exception
-
flt
Returns a float representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- float value
- Throws:
QueryException- query exception
-
dbl
Returns a double representation of the value.- Parameters:
ii- input info (can benull)- Returns:
- double value
- Throws:
QueryException- query exception
-
instanceOf
- Parameters:
tp- type- Returns:
- result of check
-
comparable
Checks if the items can be compared.- Parameters:
item- item to be compared- Returns:
- result of check
-
eq
public abstract boolean eq(Item item, Collation coll, StaticContext sc, InputInfo ii) throws QueryException Compares the items for equality.- Parameters:
item- item to be comparedcoll- collation (can benull)sc- static context; required for comparing items of type xs:QName (can benull)ii- input info (can benull)- Returns:
- result of check
- Throws:
QueryException- query exception
-
equiv
Compares the items for equivalence. As item is equivalent to another if:- both numeric values are NaN, or
- if the items have comparable types and are equal
- Parameters:
item- item to be comparedcoll- collation (can benull)ii- input info (can benull)- Returns:
- result of check
- Throws:
QueryException- query exception
-
sameKey
Compares the items for equality.- Parameters:
item- item to be comparedii- input info (can benull)- Returns:
- result of check
- Throws:
QueryException- query exception
-
diff
Returns the difference between the current and the specified item. This function is overwritten by the corresponding implementations.- Parameters:
item- item to be comparedcoll- collation (can benull)ii- input info (can benull)- Returns:
- difference
- Throws:
QueryException- query exception
-
input
Returns an input stream.- Parameters:
ii- input info (can benull)- Returns:
- input stream
- Throws:
QueryException- query exception
-
subsequence
Description copied from class:ValueReturns a subsequence of this value with the given start and length. The following properties must hold:start >= 0,length >= 0,length <= size() - start
- Specified by:
subsequencein classValue- Parameters:
start- starting positionlength- number of itemsqc- query context- Returns:
- sub sequence
-
cache
- Specified by:
cachein classValue- Parameters:
lazy- lazy cachingii- input info- Throws:
QueryException- query exception
-
atomValue
Evaluates the expression and returns the atomized items. Overwritten byXQArray,FuncItemandANode.- 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
-
atomItem
Evaluates the expression and returns the resulting, atomized item, orEmpty.VALUEif the expression yields an empty sequence. Overwritten byXQArray,FuncItemandANode.- Overrides:
atomItemin classExpr- Parameters:
qc- query contextii- input info (only required bySeqinstances, which have no input info)- Returns:
- item or
Empty.VALUE - Throws:
QueryException- query exception
-
atomSize
public long atomSize()Computes the number of atomized items. Overwritten byXQArray. -
materialize
Returns a materialized, context-independent version of this item.- Parameters:
qc- query context (ifnull, process cannot be interrupted)copy- create full copy- Returns:
- item copy, or
null) if the item cannot be materialized
-
seqType
Description copied from class:ExprReturns the static type of the resulting value. -
size
public long size()Description copied from class:ExprReturns the result size, or-1if the size is unknown. -
refineType
Description copied from class:ExprRefines the expression type.- Specified by:
refineTypein classExpr- Parameters:
expr- original expression
-
ddo
public boolean ddo()Description copied from class:ExprIndicates if this expression returns nodes in document order without duplicates. -
persistent
public final boolean persistent()Indicates if this item references a persistent database.- Returns:
- result of check
-
score
public double score()Returns a score value. Overwritten byFTNode.- Returns:
- score value
-
hash
Description copied from class:ValueReturns a hash code for this value.- Specified by:
hashin classValue- Parameters:
ii- input info- Returns:
- hash code
- Throws:
QueryException- if atomization can't be applied (e.g. function item)
-
xdmInfo
public byte[] xdmInfo()- Returns:
- type string
-
typeId
- Returns:
- type string
-
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 classExprInfo- Returns:
- result of check
-
plan
Description copied from class:ExprInfoCreates a query plan.
-