public final class FuncItem extends FItem implements Scope
Constructor and Description |
---|
FuncItem(StaticContext sc,
AnnList anns,
QNm name,
Var[] params,
FuncType type,
Expr expr,
int stackSize)
Constructor.
|
FuncItem(StaticContext sc,
AnnList anns,
QNm name,
Var[] params,
FuncType type,
Expr expr,
Value ctxValue,
long pos,
long size,
int stackSize)
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.
|
QNm |
argName(int ps)
Name of the argument at the given position.
|
int |
arity()
Number of arguments this function takes.
|
FItem |
coerceTo(FuncType ft,
QueryContext qc,
InputInfo ii,
boolean opt)
Coerces this function item to the given function type.
|
void |
compile(QueryContext qc)
Compiles the expression contained in this scope.
|
boolean |
compiled()
Checks if this scope has already been compiled.
|
QNm |
funcName()
Name of this function,
null means anonymous function. |
FuncType |
funcType()
Type of this function.
|
Expr |
inlineExpr(Expr[] exprs,
QueryContext qc,
VarScope scp,
InputInfo ii)
Tries to inline this function with the given argument expressions.
|
Item |
invItem(QueryContext qc,
InputInfo ii,
Value... args)
Internally invokes this function with the given arguments.
|
Value |
invValue(QueryContext qc,
InputInfo ii,
Value... args)
Internally invokes this function with the given arguments.
|
void |
plan(FElem plan)
Creates an expression tree.
|
int |
stackFrameSize()
Size of this function's stack frame.
|
Object |
toJava()
Returns a Java representation of the value.
|
String |
toString() |
boolean |
visit(ASTVisitor visitor)
Traverses this scope with the given
ASTVisitor . |
annotations, atomItem, deep, eq, has, invokeItem, invokeValue, string
atomItem, atomSize, atomValue, bool, comparable, dbl, dec, description, diff, ebv, equiv, flt, hash, homogeneous, input, item, itemAt, iter, iterable, itr, materialize, score, score, seqType, size, test, typeId, writeTo, xdmInfo
atomValue, cache, checkUp, compile, copy, count, exprSize, inline, isValue, iter, iterator, removable, serialize, serialize, value
atomIter, data, hasFreeVars, indexAccessible, inlineAll, isEmpty, isFunction, isVacuous, markTailCalls, optimize, optimizeEbv, sameAs, typeCheck, uses, visitAll
public final Expr expr
public FuncItem(StaticContext sc, AnnList anns, QNm name, Var[] params, FuncType type, Expr expr, int stackSize)
sc
- static contextanns
- function annotationsname
- function name (may be null
)params
- function argumentstype
- function typeexpr
- function bodystackSize
- stack-frame sizepublic FuncItem(StaticContext sc, AnnList anns, QNm name, Var[] params, FuncType type, Expr expr, Value ctxValue, long pos, long size, int stackSize)
sc
- static contextanns
- function annotationsname
- function name (may be null
)params
- function argumentstype
- function typeexpr
- function bodyctxValue
- context valuepos
- context positionsize
- context sizestackSize
- stack-frame sizepublic int arity()
XQFunctionExpr
arity
in interface XQFunctionExpr
public QNm funcName()
XQFunctionExpr
null
means anonymous function.funcName
in interface XQFunctionExpr
null
public QNm argName(int ps)
XQFunctionExpr
argName
in interface XQFunctionExpr
ps
- position of the argumentpublic FuncType funcType()
XQFunctionExpr
funcType
in interface XQFunctionExpr
public int stackFrameSize()
XQFunction
stackFrameSize
in interface XQFunction
public Value invValue(QueryContext qc, InputInfo ii, Value... args) throws QueryException
XQFunction
XQFunction.invokeValue(QueryContext, InputInfo, Value...)
instead.invValue
in interface XQFunction
qc
- query contextii
- input infoargs
- argumentsQueryException
- query exceptionpublic Item invItem(QueryContext qc, InputInfo ii, Value... args) throws QueryException
XQFunction
XQFunction.invokeItem(QueryContext, InputInfo, Value...)
instead.invItem
in interface XQFunction
qc
- query contextii
- input infoargs
- argumentsQueryException
- query exceptionpublic FItem coerceTo(FuncType ft, QueryContext qc, InputInfo ii, boolean opt) throws QueryException
FItem
coerceTo
in class FItem
ft
- function typeqc
- query contextii
- input infoopt
- if the result should be optimizedQueryException
- query exceptionpublic boolean accept(ASTVisitor visitor)
Expr
public boolean visit(ASTVisitor visitor)
Scope
ASTVisitor
.public void compile(QueryContext qc)
Scope
public boolean compiled()
Scope
public Object toJava()
Value
public Expr inlineExpr(Expr[] exprs, QueryContext qc, VarScope scp, InputInfo ii) throws QueryException
XQFunctionExpr
inlineExpr
in interface XQFunctionExpr
exprs
- argument expressionsqc
- query contextscp
- variable scopeii
- input infonull
otherwiseQueryException
- query exceptionpublic void plan(FElem plan)
ExprInfo
Copyright © 2005–2015 BaseX Team. All rights reserved.