public final class VarRef extends ParseExpr
Constructor and Description |
---|
VarRef(InputInfo info,
Var var)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
accept(ASTVisitor visitor)
Traverses this expression, notifying the visitor of declared and used variables,
and checking the tree for other recursive properties.
|
void |
checkUp()
Checks if the updating semantics are satisfied.
|
Expr |
compile(CompileContext cc)
Compiles and optimizes the expression, assigns types and cardinalities.
|
ParseExpr |
copy(CompileContext cc,
IntObjMap<Var> vm)
Copies an expression.
|
VarUsage |
count(Var v)
Checks how often a variable or context reference is used in this expression.
|
Data |
data()
Returns the data reference bound to this expression.
|
boolean |
ddo()
Indicates if this expression returns nodes in document order without duplicates.
|
String |
description()
Returns a string description of the expression.
|
boolean |
equals(Object obj)
This function is e.g.
|
int |
exprSize()
Counts the number of expressions in this expression's sub-tree.
|
boolean |
has(Flag... flags)
Indicates if an expression has one of the specified compiler properties.
|
Expr |
inline(InlineContext ic)
Inlines an expression into this one, replacing all variable or context references.
|
boolean |
inlineable(InlineContext v)
Checks if inlining is possible.
|
VarRef |
optimize(CompileContext cc)
Optimizes an already compiled expression without recompiling its sub-expressions.
|
void |
plan(QueryPlan plan)
Creates a query plan.
|
void |
plan(QueryString qs)
Creates a query string.
|
String |
toErrorString()
Returns a string representation of the expression that can be embedded in error messages.
|
Value |
value(QueryContext qc)
Evaluates the expression and returns the resulting value.
|
adoptType, atomValue, checkAllUp, checkNoEmpty, checkNoEmpty, checkNoneUp, checkNoUp, checkType, checkType, checkUp, copyType, ctxValue, ebv, item, iter, refineType, seqType, size, test, toArray, toArray, toAtomItem, toB64, toB64, toBin, toBin, toBoolean, toBoolean, toBytes, toBytes, toDouble, toDouble, toElem, toFloat, toFunc, toItem, toItem, toLong, toLong, toMap, toMap, toNode, toNode, toNodeOrNull, toNumber, toNumberOrNull, toQNm, toQNm, toToken, toToken, toTokenOrNull, toZeroToken
arg, args, atomItem, atomIter, data, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, simplifyFor, typeCheck, uses, vacuous, visitAll
public final Var var
public Expr compile(CompileContext cc)
Expr
public VarRef optimize(CompileContext cc)
Expr
public Value value(QueryContext qc)
Expr
Expr.item(QueryContext, InputInfo)
must be implemented
instead.public boolean ddo()
Expr
public boolean inlineable(InlineContext v)
Expr
InlineContext.inlineable(org.basex.query.expr.Expr...)
and:
CNode.inlineable(org.basex.query.InlineContext)
returns false if the new expression construct new nodes.
The following tests might reject inlining if the expression is a context reference:
inlineable
in class Expr
v
- inlining contextpublic VarUsage count(Var v)
Expr
Closure.optimize(org.basex.query.CompileContext)
GFLWOR.inlineForLet(org.basex.query.CompileContext)
GFLWOR.optimizePos(org.basex.query.CompileContext)
GFLWOR.simplify(org.basex.query.CompileContext)
GFLWOR.unusedVars(org.basex.query.CompileContext)
SimpleMap.optimize(org.basex.query.CompileContext)
TypeswitchGroup.optimize(org.basex.query.CompileContext)
public Expr inline(InlineContext ic) throws QueryException
Expr
InlineContext.inline(Expr)
(see invocations of this
functions for further inlinings).
The variable reference is replaced in:
The context is replaced in:
inline
in class Expr
ic
- inlining contextnull
otherwiseQueryException
- query exceptionpublic ParseExpr copy(CompileContext cc, IntObjMap<Var> vm)
Expr
inline(org.basex.query.InlineContext)
, FuncItem.inline(org.basex.query.expr.Expr[], org.basex.query.CompileContext)
,
Closure.inline(org.basex.query.InlineContext)
and StaticFunc.inline(org.basex.query.expr.Expr[], org.basex.query.CompileContext)
.copy
in class Expr
cc
- compilation contextvm
- mapping from old variable IDs to new variable copies.
Required by Closure.copy(org.basex.query.CompileContext, org.basex.util.hash.IntObjMap<org.basex.query.var.Var>)
and copy(org.basex.query.CompileContext, org.basex.util.hash.IntObjMap<org.basex.query.var.Var>)
public boolean accept(ASTVisitor visitor)
Expr
public void checkUp()
Expr
public boolean has(Flag... flags)
Expr
true
if at least flag matches an expression.public int exprSize()
Expr
StaticFunc.inline(org.basex.query.expr.Expr[], org.basex.query.CompileContext)
to check if an expression
is small enough to be inlined.public boolean equals(Object obj)
Expr
If.optimize(CompileContext)
, Switch.optimize(CompileContext)
,
Typeswitch.optimize(CompileContext)
, in order to discard identical expressions.
CmpR.mergeEbv(Expr, boolean, CompileContext)
or
CmpSR.mergeEbv(Expr, boolean, CompileContext)
,
in order to merge expressions with identical input.
CmpG.optimize(CompileContext)
or CmpV.optimize(CompileContext)
,
in order to pre-evaluate equality tests.
CmpG.optimize(CompileContext)
or
Pos.get(Expr, CmpV.OpV, InputInfo, CompileContext)
,
in order to compare the start and end value.
PathCache
, in order to find identical root values at runtime.
public String description()
ExprInfo
ExprInfo.toString()
method,
arguments are not included in the output.description
in class ExprInfo
public void plan(QueryString qs)
ExprInfo
public String toErrorString()
ExprInfo
ExprInfo.toString()
.toErrorString
in class ExprInfo
Copyright © 2005–2023 BaseX Team. All rights reserved.