public abstract class Value extends Expr implements java.lang.Iterable<Item>
Iterable interface, which is why all of its
values can also be retrieved via enhanced for (for-each) loops. Note, however, that
using the default iter() method will give you better performance.| Modifier and Type | Method and Description |
|---|---|
ItemCache |
cache()
Creates an
ItemCache, containing all items of this value. |
Value |
comp(QueryContext ctx)
Compiles and optimizes the expression, assigns data types and
cardinalities.
|
int |
count(Var v)
Counts how often the specified variable is used by an expression.
|
Data |
data()
Returns the data reference (if) attached to this value.
|
java.lang.String |
description()
Returns a string description of the expression.
|
abstract int |
hash(InputInfo ii)
Returns a hash code for this value.
|
abstract boolean |
homogenous()
Checks if all items of this value share the same type.
|
java.lang.String |
info()
Returns the simplified class name.
|
boolean |
isValue()
Tests if this is a value.
|
abstract Item |
itemAt(long pos)
Gets the item at the given position in the value.
|
abstract ValueIter |
iter()
Returns an iterator.
|
ValueIter |
iter(QueryContext ctx)
Evaluates the expression and returns an iterator on the resulting items.
|
java.util.Iterator<Item> |
iterator() |
boolean |
removable(Var v)
Checks if the specified variable is replaceable by a context item.
|
Expr |
remove(Var v)
|
abstract long |
size()
Returns the sequence size or 1.
|
abstract java.lang.Object |
toJava()
Returns a Java representation of the value.
|
boolean |
uses(Expr.Use u)
Indicates if an expression uses the specified type or operation.
|
Value |
value(QueryContext ctx)
Evaluates the expression and returns the resulting value.
|
abstract int |
writeTo(Item[] arr,
int start)
Writes this value's items out to the given array.
|
addText, compEbv, ebv, hasFreeVars, indexAccessible, indexEquivalent, isEmpty, isFunction, isItem, isVacuous, item, iterable, markTailCalls, sameAs, test, typepublic Type type
public final Value comp(QueryContext ctx)
Exprpublic final ValueIter iter(QueryContext ctx)
ExprExpr.item(org.basex.query.QueryContext, org.basex.util.InputInfo) must be implemented
by an expression, as it may be called by this method.public final java.util.Iterator<Item> iterator()
iterator in interface java.lang.Iterable<Item>public abstract ValueIter iter()
public final Value value(QueryContext ctx)
Exprpublic Data data()
public final boolean isValue()
Exprpublic abstract long size()
Exprpublic abstract java.lang.Object toJava()
throws QueryException
QueryException - query exceptionpublic boolean uses(Expr.Use u)
ExprExpr.comp(org.basex.query.QueryContext) methods to test the properties of sub-expressions.
It will return true as soon as at least one test is successful.public int count(Var v)
ExprGFLWOR.comp(org.basex.query.QueryContext) to rewrite where clauses as predicates and
remove statically bound or unused clausesGFLWOR.compHoist(org.basex.query.QueryContext) to hoist independent variablespublic final boolean removable(Var v)
ExprPreds.removable(org.basex.query.util.Var), if one of the variables is used within
a predicate.MixedPath.removable(org.basex.query.util.Var), if the variable occurs within
the path.Group.removable(org.basex.query.util.Var), as the group by expression depends on
variable references.GFLWOR.comp(org.basex.query.QueryContext) to rewrite where clauses
into predicates.public final Expr remove(Var v)
ExprVarRef expressions for the given variable
by a Context reference. This method is called by
GFLWOR.comp(org.basex.query.QueryContext) to rewrite where clauses as predicates.public java.lang.String description()
ExprInfoExprInfo.toString() method,
arguments are not included in the output.description in class ExprInfopublic final java.lang.String info()
ExprInfopublic abstract int hash(InputInfo ii) throws QueryException
ii - input infoQueryException - if atomization can't be applied (e.g. function item)public abstract int writeTo(Item[] arr, int start)
arr - array to write tostart - start positionpublic final ItemCache cache()
ItemCache, containing all items of this value.
Use with care, as compressed Values are expanded, creating many objects.public abstract Item itemAt(long pos)
pos - positionpublic abstract boolean homogenous()