Package org.basex.query.func.fn
Class ContextFn
java.lang.Object
org.basex.query.expr.ExprInfo
org.basex.query.expr.Expr
org.basex.query.expr.ParseExpr
org.basex.query.expr.Arr
org.basex.query.func.StandardFunc
org.basex.query.func.fn.ContextFn
- Direct Known Subclasses:
FnBaseUri,FnData,FnDocumentUri,FnElementWithId,FnGenerateId,FnHasChildren,FnId,FnIdref,FnLang,FnNamespaceUri,FnNilled,FnNodeName,FnNormalizeSpace,FnNumber,FnPath,FnRoot,FnString,FnStringLength
Context-based function.
- Author:
- BaseX Team 2005-21, BSD License, Christian Gruen
-
Field Summary
Fields inherited from class org.basex.query.func.StandardFunc
definition, sc -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanaccept(ASTVisitor visitor) Traverses this expression, notifying the visitor of declared and used variables, and checking the tree for other recursive properties.final booleanIndicates if the function accesses the current context.intArgument that provides the context.final VarUsageChecks how often a variable or context reference is used in this expression.protected final ExprctxArg(int i, QueryContext qc) Returns the specified argument, or the context value if it does not exist.final booleanIndicates if an expression has one of the specified compiler properties.final Exprinline(InlineContext ic) Inlines an expression into this one, replacing all variable or context references.booleanIndicates if the function will evaluate the current context.final ExprsimplifyEbv(Expr expr, CompileContext cc) Optimizes EBV checks.Methods inherited from class org.basex.query.func.StandardFunc
checkAdmin, checkArity, checkArity, checkCreate, checkData, checkPath, checkPath, coerceFunc, compileData, copy, data, data, dataLock, dateTimeToMs, description, equals, opt, optFirst, optFirst, optimize, plan, plan, serialize, simplifyArgs, toBaseUri, toBindings, toCollation, toDate, toDBNode, toEncodingOrNull, toNodeOrAtomItem, toOptions, toPath, toPath, toQuery, toQuery, vacuousMethods inherited from class org.basex.query.expr.Arr
allAreValues, args, checkUp, compile, copyAll, exprSize, flatten, inline, inlineable, mayBePositional, simplifyAllMethods inherited from class org.basex.query.expr.ParseExpr
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, valueMethods inherited from class org.basex.query.expr.Expr
arg, atomItem, atomIter, ddo, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, simplifyFor, typeCheck, uses, visitAllMethods inherited from class org.basex.query.expr.ExprInfo
toErrorString, toString
-
Constructor Details
-
ContextFn
public ContextFn()
-
-
Method Details
-
contextArg
public int contextArg()Argument that provides the context.- Returns:
- context argument.
-
contextAccess
public final boolean contextAccess()Indicates if the function accesses the current context.- Returns:
- result of check
-
ctxArg
Returns the specified argument, or the context value if it does not exist.- Parameters:
i- index of argumentqc- query context- Returns:
- expression
- Throws:
QueryException- query exception
-
has
Description copied from class:ExprIndicates if an expression has one of the specified compiler properties. This method must only be called at compile time. It is invoked to test properties of sub-expressions. It returnstrueif at least flag matches an expression.- Overrides:
hasin classStandardFunc- Parameters:
flags- flags to be checked- Returns:
- result of check
-
accept
Description copied from class:ExprTraverses this expression, notifying the visitor of declared and used variables, and checking the tree for other recursive properties. -
inlineable
public boolean inlineable()Indicates if the function will evaluate the current context.- Returns:
- result of check
-
count
Description copied from class:ExprChecks how often a variable or context reference is used in this expression. This function is called by:-
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)
-
-
inline
Description copied from class:ExprInlines an expression into this one, replacing all variable or context references. This function is called byInlineContext.inline(Expr)(see invocations of this functions for further inlinings). The variable reference is replaced in: The context is replaced in:- Overrides:
inlinein classArr- Parameters:
ic- inlining context- Returns:
- resulting expression if something has changed,
nullotherwise - Throws:
QueryException- query exception
-
simplifyEbv
Optimizes EBV checks.- Parameters:
cc- compilation contextexpr- context expression (can benull)- Returns:
- optimized expression or
null - Throws:
QueryException- query exception
-