public abstract class ParseExpr extends Expr
Modifier and Type | Field and Description |
---|---|
InputInfo |
info
Input information.
|
protected SeqType |
seqType
Static type.
|
protected long |
size
Cardinality of result;
-1 if unknown. |
Modifier | Constructor and Description |
---|---|
protected |
ParseExpr(InputInfo info)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
Item |
atomItem(QueryContext qc,
InputInfo ii)
Evaluates the expression and returns zero or one atomized item, or an error.
|
Value |
atomValue(QueryContext qc,
InputInfo ii)
Evaluates the expression and returns the atomized items.
|
protected Item |
checkAtomic(Expr ex,
QueryContext qc,
Type type)
Checks if the specified expression yields an item of the specified atomic type.
|
protected Item |
checkNoEmpty(Item it)
Checks if the specified item is no empty sequence.
|
protected Item |
checkNoEmpty(Item it,
Type type)
Checks if the specified item is no empty sequence.
|
protected void |
checkNoneUp(Expr... ex)
Ensures that none of the specified expressions performs an update.
|
protected void |
checkNoUp(Expr expr)
Ensures that the specified expression performs no updates.
|
protected Item |
checkType(Item it,
Type type)
Checks if the specified expression is an empty sequence; if yes, throws
an exception.
|
protected static Expr |
compBln(Expr ex,
InputInfo info)
Returns a boolean equivalent for the specified expression.
|
protected <T extends ParseExpr> |
copyType(T ex)
Copies this expression's return type and size to the given expression.
|
protected Value |
ctxValue(QueryContext qc)
Returns the current context value or throws an exception if the context value is not set.
|
Item |
ebv(QueryContext qc,
InputInfo ii)
Checks if the effective boolean value can be computed for this expression:
If it yields an empty sequence,
Bln.FALSE will be returned. |
Item |
item(QueryContext qc,
InputInfo ii)
Evaluates the expression and returns the resulting item,
or a
null reference if the expression yields an empty sequence. |
Iter |
iter(QueryContext qc)
Evaluates the expression and returns an iterator on the resulting items.
|
protected Expr |
optPre(Expr ex,
QueryContext qc)
Adds an optimization info for pre-evaluating the specified expression.
|
protected Expr |
optPre(QueryContext qc)
Adds an optimization info for pre-evaluating the specified expression.
|
protected Expr |
preEval(QueryContext qc)
Pre-evaluates the specified expression.
|
SeqType |
seqType()
Returns the static type of the resulting value.
|
void |
seqType(SeqType type)
Assigns a sequence type.
|
long |
size()
Returns the sequence size or 1.
|
Item |
test(QueryContext qc,
InputInfo ii)
Performs a predicate test and returns the item the if test was successful.
|
protected Array |
toArray(Expr e,
QueryContext qc)
Checks if the specified expression yields an array.
|
protected Array |
toArray(Item it)
Assures that the specified item item is an array.
|
protected Item |
toAtomItem(Expr ex,
QueryContext qc)
Checks if the evaluated expression yields a non-empty item.
|
protected B64 |
toB64(Expr ex,
QueryContext qc,
boolean empty)
Checks if the specified expression yields a Base64 item.
|
protected B64 |
toB64(Item it,
boolean empty)
Checks if the specified item is a Base64 item.
|
protected Bin |
toBin(Expr ex,
QueryContext qc)
Checks if the specified expression yields a binary item.
|
protected Bin |
toBin(Item it)
Checks if the specified item is a binary item.
|
protected boolean |
toBoolean(Expr ex,
QueryContext qc)
Checks if the specified expression yields a boolean.
|
protected boolean |
toBoolean(Item it)
Checks if the specified item is a boolean.
|
protected byte[] |
toBytes(Expr ex,
QueryContext qc)
Checks if the specified expression yields a string or binary item.
|
protected byte[] |
toBytes(Item it)
Checks if the specified item is a string or binary item.
|
protected double |
toDouble(Expr ex,
QueryContext qc)
Checks if the specified expression yields a double.
|
protected double |
toDouble(Item it)
Checks if the specified item is a double.
|
protected ANode |
toElem(Expr ex,
QueryContext qc)
Checks if the specified expression yields an element.
|
protected ANode |
toEmptyNode(Expr ex,
QueryContext qc)
Checks if the specified expression yields a node or
null . |
protected byte[] |
toEmptyToken(Expr ex,
QueryContext qc)
Checks if the specified expression yields a string or an empty sequence.
|
protected float |
toFloat(Expr ex,
QueryContext qc)
Checks if the specified expression yields a float.
|
protected FItem |
toFunc(Expr ex,
QueryContext qc)
Checks if the specified expression yields a function.
|
protected Item |
toItem(Expr ex,
QueryContext qc)
Checks if the evaluated expression yields a non-empty item.
|
protected long |
toLong(Expr ex,
QueryContext qc)
Checks if the specified expression yields an integer.
|
protected long |
toLong(Item it)
Checks if the specified item is a number.
|
protected Map |
toMap(Expr ex,
QueryContext qc)
Checks if the specified expression yields a map.
|
protected Map |
toMap(Item it)
Checks if the specified item is a map.
|
protected ANode |
toNode(Expr ex,
QueryContext qc)
Checks if the specified expression yields a node.
|
protected ANode |
toNode(Item it)
Checks if the specified non-item is a node.
|
protected ANum |
toNumber(Expr ex,
QueryContext qc)
Checks if the specified expression yields a number or
null . |
protected QNm |
toQNm(Expr ex,
QueryContext qc,
boolean empty)
Checks if the specified expression yields a QName.
|
protected QNm |
toQNm(Item it,
boolean empty)
Checks if the specified item is a QName.
|
protected byte[] |
toToken(Expr ex,
QueryContext qc)
Checks if the specified expression yields a string.
|
protected byte[] |
toToken(Item it)
Checks if the specified non-empty item is a string.
|
Value |
value(QueryContext qc)
Evaluates the expression and returns the resulting value.
|
accept, atomIter, checkUp, compile, copy, count, data, exprSize, has, hasFreeVars, indexAccessible, inline, inlineAll, isEmpty, isFunction, isVacuous, isValue, iterable, markTailCalls, optimize, optimizeEbv, removable, sameAs, typeCheck, uses, visitAll
addPlan, addPlan, description, plan, planAttr, planElem, toErrorString, toString
public InputInfo info
protected SeqType seqType
protected long size
-1
if unknown.protected ParseExpr(InputInfo info)
info
- input infopublic Iter iter(QueryContext qc) throws QueryException
Expr
Expr.item(QueryContext, InputInfo)
must be implemented
by an expression, as it may be called by this method.iter
in class Expr
qc
- query contextQueryException
- query exceptionpublic Item item(QueryContext qc, InputInfo ii) throws QueryException
Expr
null
reference if the expression yields an empty sequence.
If this method is not overwritten, Expr.iter(QueryContext)
must be implemented by an
expression, as it may be called by this method.item
in class Expr
qc
- query contextii
- input infonull
QueryException
- query exceptionpublic Value value(QueryContext qc) throws QueryException
Expr
value
in class Expr
qc
- query contextQueryException
- query exceptionpublic Value atomValue(QueryContext qc, InputInfo ii) throws QueryException
Expr
atomValue
in class Expr
qc
- query contextii
- input infoQueryException
- query exceptionpublic final Item atomItem(QueryContext qc, InputInfo ii) throws QueryException
Expr
atomItem
in class Expr
qc
- query contextii
- input infoQueryException
- query exceptionprotected final <T extends ParseExpr> T copyType(T ex)
T
- expression typeex
- expressionpublic final Item ebv(QueryContext qc, InputInfo ii) throws QueryException
Expr
Checks if the effective boolean value can be computed for this expression:
Bln.FALSE
will be returned.
A single numeric item may later be evaluated as positional predicate.
ebv
in class Expr
qc
- query contextii
- input infoQueryException
- query exceptionpublic final Item test(QueryContext qc, InputInfo ii) throws QueryException
Expr
test
in class Expr
qc
- query contextii
- input infoQueryException
- query exceptionpublic final SeqType seqType()
Expr
public final long size()
Expr
public void seqType(SeqType type)
type
- sequence typeprotected final Expr preEval(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionprotected final Expr optPre(QueryContext qc)
qc
- query contextprotected final Expr optPre(Expr ex, QueryContext qc)
ex
- optimized expressionqc
- query contextprotected static Expr compBln(Expr ex, InputInfo info)
ex
- expression to be rewritteninfo
- input infoprotected void checkNoUp(Expr expr) throws QueryException
expr
- expression (may be null
)QueryException
- query exceptionprotected final void checkNoneUp(Expr... ex) throws QueryException
ex
- expressions (may be null
, and may contain null
references)QueryException
- query exceptionprotected final Value ctxValue(QueryContext qc) throws QueryException
qc
- query contextQueryException
- query exceptionprotected final byte[] toToken(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final byte[] toEmptyToken(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final byte[] toToken(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final boolean toBoolean(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final boolean toBoolean(Item it) throws QueryException
it
- item be checkedQueryException
- query exceptionprotected final double toDouble(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final double toDouble(Item it) throws QueryException
it
- itemQueryException
- query exceptionprotected final ANum toNumber(Expr ex, QueryContext qc) throws QueryException
null
.
Returns the number, null
, or throws an exception.ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final float toFloat(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final long toLong(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final long toLong(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final ANode toNode(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be checkedqc
- query contextQueryException
- query exceptionprotected final ANode toEmptyNode(Expr ex, QueryContext qc) throws QueryException
null
.
Returns the node, null
, or throws an exception.ex
- expression to be checkedqc
- query contextnull
QueryException
- query exceptionprotected final ANode toNode(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final Item toItem(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final Item toAtomItem(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final ANode toElem(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final Bin toBin(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected Bin toBin(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final byte[] toBytes(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final B64 toB64(Expr ex, QueryContext qc, boolean empty) throws QueryException
empty
- allow empty resultex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected final B64 toB64(Item it, boolean empty) throws QueryException
empty
- allow empty resultit
- itemQueryException
- query exceptionprotected final byte[] toBytes(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected final QNm toQNm(Expr ex, QueryContext qc, boolean empty) throws QueryException
ex
- expression to be checkedqc
- query contextempty
- allow empty resultQueryException
- query exceptionprotected final QNm toQNm(Item it, boolean empty) throws QueryException
it
- itemempty
- allow empty resultQueryException
- query exceptionprotected FItem toFunc(Expr ex, QueryContext qc) throws QueryException
ex
- expression to be evaluatedqc
- query contextQueryException
- query exceptionprotected Map toMap(Expr ex, QueryContext qc) throws QueryException
ex
- expressionqc
- query contextQueryException
- query exceptionprotected Map toMap(Item it) throws QueryException
it
- item to checkQueryException
- if the item is not a mapprotected Array toArray(Expr e, QueryContext qc) throws QueryException
e
- expressionqc
- query contextQueryException
- query exceptionprotected Array toArray(Item it) throws QueryException
it
- item to checkQueryException
- if the item is not an arrayprotected Item checkAtomic(Expr ex, QueryContext qc, Type type) throws QueryException
ex
- expression to be evaluatedqc
- query contexttype
- type to be checkedQueryException
- query exceptionprotected Item checkType(Item it, Type type) throws QueryException
it
- item to be checkedtype
- type to be checkedQueryException
- query exceptionprotected final Item checkNoEmpty(Item it) throws QueryException
it
- item to be checkedQueryException
- query exceptionprotected Item checkNoEmpty(Item it, Type type) throws QueryException
it
- item to be checkedtype
- expected typeQueryException
- query exceptionCopyright © 2005–2015 BaseX Team. All rights reserved.