public abstract class StandardFunc extends Arr
Modifier and Type | Field and Description |
---|---|
StaticContext |
sc
Static context.
|
Function |
sig
Function signature.
|
Modifier | Constructor and Description |
---|---|
protected |
StandardFunc()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected Expr |
arg(int index,
QueryContext qc)
Returns the specified argument, or the context value if it does not exist.
|
protected void |
cache(Iter iter,
ValueBuilder vb,
QueryContext qc)
Caches and materializes all items of the specified iterator.
|
protected void |
checkAdmin(QueryContext qc)
Checks if the current user has create permissions.
|
protected FItem |
checkArity(Expr e,
int a,
QueryContext qc)
Casts and checks the function item for its arity.
|
protected void |
checkCreate(QueryContext qc)
Checks if the current user has create permissions.
|
protected Data |
checkData(QueryContext qc)
Returns a database instance for the first string argument of the function.
|
protected IO |
checkPath(Expr path,
QueryContext qc)
Returns a valid reference if a file is found in the specified path or the static base uri.
|
Expr |
compile(QueryContext qc,
VarScope scp)
Compiles and optimizes the expression, assigns types and cardinalities.
|
StandardFunc |
copy(QueryContext qc,
VarScope scp,
IntObjMap<Var> vs)
Copies an expression.
|
protected boolean |
dataLock(ASTVisitor visitor,
int i)
Tries to mark the specified argument for locking.
|
protected long |
dateTimeToMs(Expr ex,
QueryContext qc)
Converts the specified dateTime to milliseconds.
|
String |
description()
Returns a string description of the expression.
|
boolean |
has(Expr.Flag flag)
Indicates if an expression has the specified compiler property.
|
boolean |
isFunction(Function f)
Checks if this expression is a certain function.
|
boolean |
isVacuous()
Tests if this is a vacuous expression (empty sequence or error function).
|
protected static boolean |
oneOf(Function sig,
Function... sigs)
Compares several signatures for equality.
|
protected Expr |
opt(QueryContext qc,
VarScope scp)
Performs function specific optimizations.
|
Expr |
optimize(QueryContext qc,
VarScope scp)
Optimizes an already compiled expression without recompiling its sub-expressions.
|
void |
plan(FElem plan)
Creates an expression tree.
|
boolean |
sameAs(Expr cmp)
Compares the current and specified expression for equality.
|
protected byte[] |
serialize(Iter ir,
SerializerOptions opts,
QueryError err)
Serializes the data from the specified iterator.
|
protected HashMap<String,Value> |
toBindings(int i,
QueryContext qc)
Returns all keys and values of the specified binding argument.
|
protected Collation |
toCollation(int i,
QueryContext qc)
Checks if the specified collation is supported.
|
protected DBNode |
toDBNode(Item it)
Checks if the specified expression is a database node.
|
protected String |
toEncoding(int i,
QueryError err,
QueryContext qc)
Returns a normalized encoding representation.
|
protected <E extends Options> |
toOptions(int i,
QNm qnm,
E opts,
QueryContext qc)
Parses the options at the specified index.
|
protected Path |
toPath(int i,
QueryContext qc)
Converts the specified argument to a file path.
|
String |
toString() |
accept, allAreValues, checkUp, copyAll, count, exprSize, inline, oneIsEmpty, removable, toString
atomItem, atomValue, checkAtomic, checkNoEmpty, checkNoEmpty, checkNoneUp, checkNoUp, checkType, compBln, copyType, ctxValue, ebv, item, iter, optPre, optPre, preEval, seqType, seqType, size, test, toArray, toArray, toAtomItem, toB64, toB64, toBin, toBin, toBoolean, toBoolean, toBytes, toBytes, toDouble, toDouble, toElem, toEmptyNode, toEmptyToken, toFloat, toFunc, toItem, toLong, toLong, toMap, toMap, toNode, toNode, toNumber, toQNm, toQNm, toToken, toToken, value
atomIter, data, hasFreeVars, indexAccessible, inlineAll, isEmpty, isValue, iterable, markTailCalls, optimizeEbv, typeCheck, uses, visitAll
public Function sig
public StaticContext sc
public final Expr compile(QueryContext qc, VarScope scp) throws QueryException
Expr
QueryContext.compile()
.compile
in class Arr
qc
- query contextscp
- variable scopeQueryException
- query exceptionpublic final Expr optimize(QueryContext qc, VarScope scp) throws QueryException
Expr
optimize
in class Expr
qc
- query contextscp
- variable scopeQueryException
- query exceptionprotected Expr opt(QueryContext qc, VarScope scp) throws QueryException
qc
- query contextscp
- variable scopeQueryException
- query exceptionpublic final StandardFunc copy(QueryContext qc, VarScope scp, IntObjMap<Var> vs)
Expr
protected byte[] serialize(Iter ir, SerializerOptions opts, QueryError err) throws QueryException
ir
- data to serializeopts
- serialization parameterserr
- error codeQueryException
- query exceptionpublic boolean has(Expr.Flag flag)
Expr
true
if at least one test is successful.public final boolean isFunction(Function f)
Expr
isFunction
in class Expr
f
- function definitionpublic boolean isVacuous()
Expr
public final String description()
ExprInfo
ExprInfo.toString()
method,
arguments are not included in the output.description
in class ExprInfo
public final void plan(FElem plan)
ExprInfo
protected Expr arg(int index, QueryContext qc) throws QueryException
index
- argument indexqc
- query contextQueryException
- query exceptionprotected final DBNode toDBNode(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final Collation toCollation(int i, QueryContext qc) throws QueryException
i
- argument indexqc
- query contextnull
(default collation)QueryException
- query exceptionprotected Path toPath(int i, QueryContext qc) throws QueryException
i
- argument indexqc
- query contextQueryException
- query exceptionprotected IO checkPath(Expr path, QueryContext qc) throws QueryException
path
- file pathqc
- query contextQueryException
- query exceptionprotected final String toEncoding(int i, QueryError err, QueryContext qc) throws QueryException
i
- index of encoding argumenterr
- error for invalid encodingqc
- query contextQueryException
- query exceptionprotected <E extends Options> E toOptions(int i, QNm qnm, E opts, QueryContext qc) throws QueryException
E
- options typei
- index of options argumentqnm
- QNameopts
- optionsqc
- query contextQueryException
- query exceptionprotected final HashMap<String,Value> toBindings(int i, QueryContext qc) throws QueryException
i
- index of argumentqc
- query contextQueryException
- query exceptionprotected final Data checkData(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionprotected final void checkAdmin(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionprotected final void checkCreate(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionprotected FItem checkArity(Expr e, int a, QueryContext qc) throws QueryException
e
- expressiona
- arityqc
- query contextQueryException
- query exceptionprotected final long dateTimeToMs(Expr ex, QueryContext qc) throws QueryException
ex
- expressionqc
- query contextQueryException
- query exceptionprotected final boolean dataLock(ASTVisitor visitor, int i)
visitor
- visitori
- index of argumentprotected final void cache(Iter iter, ValueBuilder vb, QueryContext qc) throws QueryException
iter
- iteratorvb
- value builderqc
- query contextQueryException
- query exceptionprotected static boolean oneOf(Function sig, Function... sigs)
sig
- signature to be foundsigs
- signatures to be comparedCopyright © 2005–2015 BaseX Team. All rights reserved.