|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.basex.data.ExprInfo
org.basex.query.expr.Expr
org.basex.query.value.Value
public abstract class Value
Abstract value.
This class also implements the Iterable
interface, which is why all of its
values can also be retrieved via enhanced for (for-each) loops. The default
iter()
method will provide better performance.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.basex.query.expr.Expr |
---|
Expr.Flag |
Field Summary | |
---|---|
Type |
type
Data type. |
Constructor Summary | |
---|---|
Value(Type t)
Constructor. |
Method Summary | |
---|---|
boolean |
accept(ASTVisitor visitor)
Traverses this expression, notifying the visitor of declared and used variables, and checking the tree for other recursive properties. |
ValueBuilder |
cache()
Creates an ValueBuilder , containing all items of this value. |
void |
checkUp()
Checks if all updating expressions are correctly placed. |
Value |
compile(QueryContext ctx,
VarScope scp)
Compiles and optimizes the expression, assigns data types and cardinalities. |
Value |
copy(QueryContext ctx,
VarScope scp,
IntObjMap<Var> vs)
Copies an expression. |
VarUsage |
count(Var v)
Checks how often a variable is used in this expression. |
Data |
data()
Returns the data reference (if) attached to this value. |
java.lang.String |
description()
Returns a string description of the expression. |
int |
exprSize()
Counts the number of expressions in this expression's sub-tree. |
boolean |
has(Expr.Flag flag)
Indicates if an expression has the specified compiler property. |
abstract int |
hash(InputInfo ii)
Returns a hash code for this value. |
abstract boolean |
homogeneous()
Checks if all items of this value share the same type. |
Expr |
inline(QueryContext ctx,
VarScope scp,
Var v,
Expr e)
Inlines an expression into this one, replacing all references to the given variable. |
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. |
ArrayOutput |
serialize()
Serializes the value, using the standard XML serializer, and returns the cached result. |
abstract long |
size()
Returns the sequence size or 1. |
abstract java.lang.Object |
toJava()
Returns a Java representation of the value. |
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. |
Methods inherited from class org.basex.query.expr.Expr |
---|
addText, compEbv, copy, ebv, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isVacuous, item, iterable, markTailCalls, optimize, sameAs, test, type, uses, visitAll |
Methods inherited from class org.basex.data.ExprInfo |
---|
addPlan, addPlan, info, plan, planAttr, planElem, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public Type type
Constructor Detail |
---|
public Value(Type t)
t
- data typeMethod Detail |
---|
public final void checkUp()
Expr
checkUp
in class Expr
public final Value compile(QueryContext ctx, VarScope scp)
Expr
compile
in class Expr
ctx
- query contextscp
- variable scope
public final ValueIter iter(QueryContext ctx)
Expr
Expr.item(org.basex.query.QueryContext, org.basex.util.InputInfo)
must be implemented
by an expression, as it may be called by this method.
iter
in class Expr
ctx
- query context
public final java.util.Iterator<Item> iterator()
iterator
in interface java.lang.Iterable<Item>
public abstract ValueIter iter()
public final Value value(QueryContext ctx)
Expr
value
in class Expr
ctx
- query context
public Data data()
DBNode
and DBNodeSeq
.
public final boolean isValue()
Expr
isValue
in class Expr
public abstract long size()
Expr
size
in class Expr
public abstract java.lang.Object toJava() throws QueryException
QueryException
- query exceptionpublic boolean has(Expr.Flag flag)
Expr
Expr.compile(org.basex.query.QueryContext, org.basex.query.var.VarScope)
methods to test properties of sub-expressions.
It returns true
if at least one test is successful.
has
in class Expr
flag
- flag to be found
public final boolean removable(Var v)
Expr
Preds.removable(org.basex.query.var.Var)
, if one of the variables is used within a predicate.MixedPath.removable(org.basex.query.var.Var)
, if the variable occurs within the path.GFLWOR.compile(org.basex.query.QueryContext, org.basex.query.var.VarScope)
to rewrite where clauses
into predicates.
removable
in class Expr
v
- variable to be replaced
public final VarUsage count(Var v)
Expr
count
in class Expr
v
- variable to look for
VarUsage
public Expr inline(QueryContext ctx, VarScope scp, Var v, Expr e) throws QueryException
Expr
inline
in class Expr
ctx
- query context for recompilationscp
- variable scope for recompilationv
- variable to replacee
- expression to inline
null
otherwise
QueryException
- query exceptionpublic Value copy(QueryContext ctx, VarScope scp, IntObjMap<Var> vs)
Expr
copy
in class Expr
ctx
- query contextscp
- variable scope for creating new variablesvs
- mapping from old variable IDs to new variable copies
public java.lang.String description()
ExprInfo
ExprInfo.toString()
method,
arguments are not included in the output.
description
in class ExprInfo
public abstract int hash(InputInfo ii) throws QueryException
ii
- input info
QueryException
- if atomization can't be applied (e.g. function item)public abstract int writeTo(Item[] arr, int start)
arr
- array to write tostart
- start position
public final ValueBuilder cache()
ValueBuilder
, containing all items of this value.
Use with care, as compressed Values are expanded, creating many objects.
public final ArrayOutput serialize() throws QueryException
QueryException
- query exceptionpublic abstract Item itemAt(long pos)
pos
- position
public abstract boolean homogeneous()
public boolean accept(ASTVisitor visitor)
Expr
accept
in class Expr
visitor
- visitor
public final int exprSize()
Expr
exprSize
in class Expr
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |