public final class Var extends ParseExpr
| Modifier and Type | Field and Description |
|---|---|
Ann |
ann
Annotations.
|
boolean |
declared
Declaration flag.
|
boolean |
global
Global flag.
|
QNm |
name
Variable name.
|
SeqType |
ret
Expected return type.
|
| Modifier and Type | Method and Description |
|---|---|
Var |
bind(Expr e,
QueryContext ctx)
Binds the specified expression to the variable.
|
Var |
bind(Value v,
QueryContext ctx)
Binds the specified value to the variable.
|
void |
checkUp()
Checks if the variable contains no updating expression.
|
Var |
comp(QueryContext ctx)
Compiles and optimizes the expression, assigns data types and
cardinalities.
|
Var |
copy()
Returns a copy of the variable.
|
int |
count(Var v)
Counts how often the specified variable is used by an expression.
|
static Var |
create(QueryContext ctx,
InputInfo ii,
QNm n,
Ann a)
Creates a new variable.
|
static Var |
create(QueryContext ctx,
InputInfo ii,
QNm n,
SeqType t,
Ann a)
Creates a new variable.
|
static Var |
create(QueryContext ctx,
InputInfo ii,
QNm n,
Value v,
Ann a)
Creates a new variable.
|
Expr |
expr()
Returns the bound expression.
|
boolean |
is(Var v)
Checks whether the given variable is identical to this one, i.e.
|
Item |
item(QueryContext ctx,
InputInfo ii)
Evaluates the expression and returns the resulting item or
a
null reference, if the expression yields an empty sequence. |
Iter |
iter(QueryContext ctx)
Evaluates the expression and returns an iterator on the resulting items.
|
void |
plan(Serializer ser)
Serializes the expression tree.
|
boolean |
removable(Var v)
Checks if the specified variable is replaceable by a context item.
|
Var |
remove(Var v)
|
void |
reset(SeqType t,
QueryContext ctx)
Sets the specified variable type.
|
boolean |
sameAs(Expr cmp)
Compares the current and specified expression for equality.
|
java.lang.String |
toString() |
SeqType |
type()
Returns the sequence type of the evaluated 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.
|
checkBln, checkColl, checkCreate, checkCtx, checkDbl, checkDBNode, checkEStr, checkEStr, checkIO, checkItem, checkItr, checkItr, checkMap, checkNode, checkNoEmpty, checkStr, checkType, checkUp, checkUp, checkWrite, compBln, ebv, optPre, preEval, size, testaddText, compEbv, hasFreeVars, indexAccessible, indexEquivalent, isEmpty, isFunction, isItem, isVacuous, isValue, iterable, markTailCallsdescription, infopublic final QNm name
public final Ann ann
public SeqType ret
public boolean global
public boolean declared
public static Var create(QueryContext ctx, InputInfo ii, QNm n, SeqType t, Ann a)
ctx - query contextii - input infon - variable namet - typea - annotationspublic static Var create(QueryContext ctx, InputInfo ii, QNm n, Ann a)
ctx - query contextii - input infon - variable namea - annotationspublic static Var create(QueryContext ctx, InputInfo ii, QNm n, Value v, Ann a)
ctx - query contextii - input infon - variable namev - variable to be bounda - annotationspublic void checkUp()
throws QueryException
QueryException - query exceptionpublic Var comp(QueryContext ctx) throws QueryException
Exprcomp in class Exprctx - query contextQueryException - query exceptionpublic void reset(SeqType t, QueryContext ctx) throws QueryException
t - typectx - query contextQueryException - query exceptionpublic Var bind(Expr e, QueryContext ctx) throws QueryException
e - expression to be setctx - query contextQueryException - query exceptionpublic Expr expr()
public Var bind(Value v, QueryContext ctx) throws QueryException
v - value to be setctx - query contextQueryException - query exceptionpublic Item item(QueryContext ctx, InputInfo ii) throws QueryException
Exprnull reference, if the expression yields an empty sequence.
If this method is not overwritten, Expr.iter(org.basex.query.QueryContext) must be implemented
by an expression, as it may be called by this method.item in class ParseExprctx - query contextii - input infoQueryException - query exceptionpublic Iter iter(QueryContext ctx) throws QueryException
ExprExpr.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 ParseExprctx - query contextQueryException - query exceptionpublic Value value(QueryContext ctx) throws QueryException
Exprvalue in class ParseExprctx - query contextQueryException - query exceptionpublic boolean is(Var v)
v - variable to checktrue, if the IDs are equal, false otherwisepublic Var copy()
public 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 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 Var 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 SeqType type()
Exprpublic boolean sameAs(Expr cmp)
Exprpublic void plan(Serializer ser) throws java.io.IOException
ExprInfo