Package org.basex.query.value.item
Class Dummy
- java.lang.Object
-
- org.basex.query.expr.ExprInfo
-
- org.basex.query.expr.Expr
-
- org.basex.query.value.Value
-
- org.basex.query.value.item.Dummy
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Value
atomValue(QueryContext qc, InputInfo ii)
Evaluates the expression and returns the atomized items.void
cache(boolean lazy, InputInfo ii)
Caches data of lazy items (i.e., those implementing theLazy
interface).Data
data()
Returns the data reference bound to this expression.boolean
equals(Object obj)
This function is e.g. called by:If.optimize(CompileContext)
,Switch.optimize(CompileContext)
,Typeswitch.optimize(CompileContext)
, in order to discard identical expressions.Item
item(QueryContext qc, InputInfo ii)
Evaluates the expression and returns the resulting item, orEmpty.VALUE
if the expression yields an empty sequence.Item
itemAt(long pos)
Returns the item at the given position in the value.BasicIter<Item>
iter()
Returns an iterator.Value
materialize(Predicate<Data> test, InputInfo ii, QueryContext qc)
Returns a materialized version of this value without dependencies to persistent data.boolean
materialized(Predicate<Data> test, InputInfo ii)
Checks if this value is materialized, i.e., contains no persistent database nodes or function items.void
refineType(Expr ex)
Refines the expression type.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.SeqType
seqType()
Returns the static type of the resulting value.long
size()
Returns the result size, or-1
if the size is unknown.Value
subsequence(long start, 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.String
toJava()
Returns a Java representation of the value.void
toString(QueryString qs)
Creates a query string.void
toXml(QueryPlan plan)
Creates a query plan.-
Methods inherited from class org.basex.query.value.Value
accept, checkUp, compactify, compile, copy, count, exprSize, get, has, inline, inlineable, isEmpty, isItem, iter, iterator, refineType, refineType, serialize, serialize, serialize, value, write
-
Methods inherited from class org.basex.query.expr.Expr
arg, args, atomItem, atomIter, ddo, funcType, hasFreeVars, indexAccessible, info, isSimple, markTailCalls, mergeEbv, optimize, optimizePos, simplify, simplifyFor, typeCheck, uses, vacuous, visitAll
-
Methods inherited from class org.basex.query.expr.ExprInfo
description, info, toErrorString, toString
-
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
-
-
-
-
Constructor Detail
-
Dummy
public Dummy(Expr expr, boolean item)
Constructor.- Parameters:
expr
- input expressionitem
- focus single item
-
-
Method Detail
-
seqType
public SeqType seqType()
Description copied from class:Expr
Returns the static type of the resulting value.
-
size
public long size()
Description copied from class:Expr
Returns the result size, or-1
if the size is unknown.
-
toJava
public String toJava()
Description copied from class:Value
Returns a Java representation of the value.
-
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.
-
toXml
public void toXml(QueryPlan plan)
Description copied from class:ExprInfo
Creates a query plan.
-
materialize
public Value materialize(Predicate<Data> test, InputInfo ii, QueryContext qc) throws QueryException
Description copied from class:Value
Returns a materialized version of this value without dependencies to persistent data. Raises an error if the value contains function items.- Specified by:
materialize
in classValue
- Parameters:
test
- test to check if a node can be adopted unchangedii
- input info (can benull
)qc
- query context- Returns:
- materialized value
- Throws:
QueryException
- query exception
-
materialized
public boolean materialized(Predicate<Data> test, InputInfo ii) throws QueryException
Description copied from class:Value
Checks if this value is materialized, i.e., contains no persistent database nodes or function items.- Specified by:
materialized
in classValue
- Parameters:
test
- test to check if a node can be adopted unchangedii
- input info (can benull
)- Returns:
- result of check
- Throws:
QueryException
- query exception
-
subsequence
public Value subsequence(long start, long length, QueryContext qc)
Description copied from class:Value
Returns 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:
subsequence
in classValue
- Parameters:
start
- starting positionlength
- number of itemsqc
- query context- Returns:
- sub sequence
-
cache
public void cache(boolean lazy, InputInfo ii) throws QueryException
Description copied from class:Value
Caches data of lazy items (i.e., those implementing theLazy
interface). By calling this method, the streaming feature of lazy items will be disabled.- Specified by:
cache
in classValue
- Parameters:
lazy
- iffalse
, cache immediately. iftrue
, caching is deferred until the data is actually requestedii
- input info (can benull
)- Throws:
QueryException
- query exception
-
sameType
public boolean sameType()
Description copied from class:Value
Checks if all items of the sequence are of the same type.
-
itemAt
public Item 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.
-
reverse
public Value reverse(QueryContext qc)
Description copied from class:Value
Returns all items of this value in reverse order.
-
item
public Item item(QueryContext qc, InputInfo ii) throws QueryException
Description copied from class:Expr
Evaluates the expression and returns the resulting item, orEmpty.VALUE
if the expression yields an empty sequence. If this method is not implemented,Expr.value(QueryContext)
must be implemented instead.- Specified by:
item
in classExpr
- Parameters:
qc
- query contextii
- input info (can benull
); required for thoseValue
instances that have no input info)- Returns:
- item or
Empty.VALUE
- Throws:
QueryException
- query exception
-
atomValue
public Value atomValue(QueryContext qc, InputInfo ii) throws QueryException
Description copied from class:Expr
Evaluates the expression and returns the atomized items.- Specified by:
atomValue
in classExpr
- Parameters:
qc
- query contextii
- input info (can benull
); required for thoseValue
instances that have no input info)- Returns:
- atomized item
- Throws:
QueryException
- query exception
-
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.- Specified by:
test
in classExpr
- 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
-
refineType
public void refineType(Expr ex)
Description copied from class:Expr
Refines the expression type.- Specified by:
refineType
in classExpr
- Parameters:
ex
- original expression
-
toString
public void toString(QueryString qs)
Description copied from class:ExprInfo
Creates a query string.
-
-