|
||||||||||
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.expr.ParseExpr
org.basex.query.expr.Single
org.basex.query.func.InlineFunc
public final class InlineFunc
Inline function.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.basex.query.expr.Expr |
---|
Expr.Flag |
Field Summary |
---|
Fields inherited from class org.basex.query.expr.Single |
---|
expr |
Fields inherited from class org.basex.query.expr.ParseExpr |
---|
info, size, type |
Constructor Summary | |
---|---|
InlineFunc(InputInfo ii,
SeqType r,
Var[] v,
Expr e,
Ann a,
StaticContext stc,
VarScope scp)
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. |
void |
checkUp()
Checks if all updating expressions are correctly placed. |
void |
compile(QueryContext ctx)
Compiles the expression contained in this scope. |
Expr |
compile(QueryContext ctx,
VarScope scp)
Compiles and optimizes the expression, assigns data types and cardinalities. |
boolean |
compiled()
Checks if this scope has already been compiled. |
Expr |
copy(QueryContext cx,
VarScope scp,
IntObjMap<Var> vs)
Copies an expression. |
VarUsage |
count(Var v)
Checks how often a variable is used in this 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. |
Expr |
inline(QueryContext ctx,
VarScope scp,
Var v,
Expr e)
Inlines an expression into this one, replacing all references to the given variable. |
boolean |
isVacuous()
Tests if this is a vacuous expression (empty sequence or error function). |
FuncItem |
item(QueryContext ctx,
InputInfo ii)
Evaluates the expression and returns the resulting item or a null reference, if the expression yields an empty sequence. |
ValueIter |
iter(QueryContext ctx)
Evaluates the expression and returns an iterator on the resulting items. |
Expr |
optimize(QueryContext ctx,
VarScope scp)
Optimizes an already compiled expression without recompiling its sub-expressions. |
void |
plan(FElem plan)
Creates an expression tree. |
boolean |
removable(Var v)
Checks if the specified variable is replaceable by a context item. |
java.lang.String |
toString()
|
SeqType |
type()
Returns the static type of the evaluated value. |
Value |
value(QueryContext ctx)
Evaluates the expression and returns the resulting value. |
boolean |
visit(ASTVisitor visitor)
Traverses this scope with the given ASTVisitor . |
Methods inherited from class org.basex.query.expr.ParseExpr |
---|
checkAdmin, checkAllUp, checkBinary, checkBln, checkColl, checkCreate, checkCtx, checkDbl, checkDBNode, checkEStr, checkEStr, checkFunc, checkItem, checkItr, checkItr, checkMap, checkNode, checkNode, checkNode, checkNoEmpty, checkNoneUp, checkNoUp, checkQNm, checkStr, checkStr, checkStrBin, checkType, checkWrite, compBln, copyType, ebv, optPre, preEval, size, test |
Methods inherited from class org.basex.query.expr.Expr |
---|
addText, compEbv, copy, hasFreeVars, indexAccessible, indexEquivalent, inlineAll, isEmpty, isFunction, isItem, isValue, iterable, markTailCalls, sameAs, uses, visitAll |
Methods inherited from class org.basex.data.ExprInfo |
---|
addPlan, addPlan, description, info, planAttr, planElem |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public InlineFunc(InputInfo ii, SeqType r, Var[] v, Expr e, Ann a, StaticContext stc, VarScope scp)
ii
- input infor
- return typev
- argumentse
- function bodya
- annotationsstc
- static contextscp
- scopeMethod Detail |
---|
public void compile(QueryContext ctx) throws QueryException
Scope
compile
in interface Scope
ctx
- query context
QueryException
- compilation errorspublic Expr compile(QueryContext ctx, VarScope scp) throws QueryException
Expr
compile
in class Single
ctx
- query contextscp
- variable scope
QueryException
- query exceptionpublic Expr optimize(QueryContext ctx, VarScope scp) throws QueryException
Expr
optimize
in class Expr
ctx
- query contextscp
- variable scope
QueryException
- query exceptionpublic VarUsage count(Var v)
Expr
count
in class Single
v
- variable to look for
VarUsage
public Expr inline(QueryContext ctx, VarScope scp, Var v, Expr e) throws QueryException
Expr
inline
in class Single
ctx
- query context for recompilationscp
- variable scope for recompilationv
- variable to replacee
- expression to inline
null
otherwise
QueryException
- query exceptionpublic Expr copy(QueryContext cx, VarScope scp, IntObjMap<Var> vs)
Expr
copy
in class Expr
cx
- query contextscp
- variable scope for creating new variablesvs
- mapping from old variable IDs to new variable copies
public FuncItem item(QueryContext ctx, InputInfo ii) throws QueryException
Expr
null
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 ParseExpr
ctx
- query contextii
- input info
QueryException
- query exceptionpublic Value value(QueryContext ctx) throws QueryException
Expr
value
in class ParseExpr
ctx
- query context
QueryException
- query exceptionpublic ValueIter iter(QueryContext ctx) throws QueryException
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 ParseExpr
ctx
- query context
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 Single
flag
- flag to be found
public 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 Single
v
- variable to be replaced
public void plan(FElem plan)
ExprInfo
plan
in class Single
plan
- root elementpublic boolean visit(ASTVisitor visitor)
Scope
ASTVisitor
.
visit
in interface Scope
visitor
- visitor
public java.lang.String toString()
toString
in class ExprInfo
public void checkUp() throws QueryException
Expr
checkUp
in class Single
QueryException
- query exceptionpublic boolean isVacuous()
Expr
isVacuous
in class Expr
public SeqType type()
Expr
type
in class ParseExpr
public boolean accept(ASTVisitor visitor)
Expr
accept
in class Single
visitor
- visitor
public int exprSize()
Expr
exprSize
in class Single
public boolean compiled()
Scope
compiled
in interface Scope
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |