Package org.basex.query.expr
Class Preds
- 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.expr.Preds
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Expr
compile(CompileContext cc)
Compiles and optimizes the expression, assigns types and cardinalities.Expr
flattenEbv(Expr root, boolean ebv, CompileContext cc)
Flattens predicates for boolean evaluation.boolean
inlineable(InlineContext ic)
Checks if inlining is possible.protected boolean
match(Item item, QueryContext qc)
Checks if the specified item matches the predicates.boolean
mayBePositional()
Checks if at least one of the predicates may be positional.protected static boolean
numeric(Expr expr)
Checks if the specified expression returns an empty sequence or a deterministic numeric value.protected boolean
simplify(CompileContext cc, Expr root)
Simplifies all predicates.void
toString(QueryString qs)
Creates a query string.protected abstract Expr
type(Expr expr)
Assigns the expression type.-
Methods inherited from class org.basex.query.expr.Arr
accept, allAreValues, args, checkUp, copyAll, count, equals, exprSize, flatten, has, inline, mayBePositional, removeEmpty, simplifyAll, toXml
-
Methods inherited from class org.basex.query.expr.ParseExpr
adoptType, atomValue, checkAllUp, checkNoEmpty, checkNoEmpty, checkNoneUp, checkNoUp, checkType, checkType, checkUp, copyType, ctxValue, data, ebv, info, item, iter, refineType, seqType, size, test, toArray, toArray, toAtomItem, toB64, toB64, toBin, toBin, toBoolean, toBoolean, toBytes, toBytes, toDouble, toDouble, toElem, toFloat, toFunction, toItem, toItem, toLong, toLong, toMap, toMap, toNode, toNode, toNodeOrNull, toNumber, toNumberOrNull, toQNm, toQNm, toString, toString, toStringOrNull, toToken, toToken, toTokenOrNull, toZeroToken, value
-
Methods inherited from class org.basex.query.expr.Expr
arg, atomItem, atomIter, copy, ddo, funcType, hasFreeVars, indexAccessible, isSimple, markTailCalls, mergeEbv, optimize, optimizePos, simplify, simplifyFor, typeCheck, uses, vacuous, visitAll
-
Methods inherited from class org.basex.query.expr.ExprInfo
description, toErrorString, toString
-
-
-
-
Method Detail
-
compile
public Expr compile(CompileContext cc) throws QueryException
Description copied from class:Expr
Compiles and optimizes the expression, assigns types and cardinalities.- Overrides:
compile
in classArr
- Parameters:
cc
- compilation context- Returns:
- optimized expression
- Throws:
QueryException
- query exception
-
type
protected abstract Expr type(Expr expr)
Assigns the expression type.- Parameters:
expr
- root expression (can benull
)- Returns:
- actual root expression (can be
null
)
-
match
protected final boolean match(Item item, QueryContext qc) throws QueryException
Checks if the specified item matches the predicates.- Parameters:
item
- item to be checkedqc
- query context- Returns:
- result of check
- Throws:
QueryException
- query exception
-
simplify
protected final boolean simplify(CompileContext cc, Expr root) throws QueryException
Simplifies all predicates.- Parameters:
cc
- compilation contextroot
- root expression- Returns:
true
if evaluation can be skipped- Throws:
QueryException
- query exception
-
flattenEbv
public final Expr flattenEbv(Expr root, boolean ebv, CompileContext cc) throws QueryException
Flattens predicates for boolean evaluation. Drops solitary context values, flattens nested predicates.- Parameters:
root
- root expressionebv
- EBV checkcc
- compilation context- Returns:
- optimized or original expression
- Throws:
QueryException
- query exception
-
numeric
protected static boolean numeric(Expr expr)
Checks if the specified expression returns an empty sequence or a deterministic numeric value.- Parameters:
expr
- expression- Returns:
- result of check
-
mayBePositional
public boolean mayBePositional()
Checks if at least one of the predicates may be positional.- Returns:
- result of check
-
inlineable
public boolean inlineable(InlineContext ic)
Description copied from class:Expr
Checks if inlining is possible. This function is called byInlineContext.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:- Overrides:
inlineable
in classArr
- Parameters:
ic
- inlining context- Returns:
- result of check
-
toString
public void toString(QueryString qs)
Description copied from class:ExprInfo
Creates a query string.
-
-