public class BooleanFn extends SystemFunctionCall implements Negatable, Callable
operation
argument
EFFECTIVE_BOOLEAN_VALUE, EVALUATE_METHOD, ITEM_FEED_METHOD, ITERATE_METHOD, locationId, MAX_SEQUENCE_LENGTH, MAX_STRING_LENGTH, PROCESS_METHOD, staticProperties, UNBOUNDED_LOWER, UNBOUNDED_UPPER, WATCH_METHOD
Constructor and Description |
---|
BooleanFn() |
Modifier and Type | Method and Description |
---|---|
BooleanValue |
call(XPathContext c,
Sequence[] arguments)
Call the Callable.
|
void |
checkArguments(ExpressionVisitor visitor)
Static analysis: prevent sorting of the argument
|
boolean |
effectiveBooleanValue(XPathContext c)
Evaluate the effective boolean value
|
BooleanValue |
evaluateItem(XPathContext context)
Evaluate the function
|
ExpressionCompiler |
getExpressionCompiler()
Return the compiler of the BooleanFn expression
|
BooleanFnAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
boolean |
isNegatable(ExpressionVisitor visitor)
Check whether this specific instance of the expression is negatable
|
Expression |
negate()
Create an expression that returns the negation of this expression
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
static Expression |
rewriteEffectiveBooleanValue(Expression exp,
ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Optimize an expression whose effective boolean value is required.
|
addContextDocumentArgument, addDocToPathMap, bindStaticContext, computeCardinality, computeSpecialProperties, copy, equalOrNull, equals, getContextNode, getConvertingCallable, getDefaultArgumentNode, getDetails, getErrorCodeForTypeErrors, getFunctionItemType, getImplementationMethod, getItemType, getOperation, getRequiredType, makeSystemFunction, operands, setDetails, toShortString, useContextItemAsDefault
addExternalFunctionCallToPathMap, checkArgumentCount, explain, getArguments, getDisplayName, getExpressionName, getFunctionName, getNumberOfArguments, hashCode, preEvaluate, promote, replaceOperand, setArguments, setFunctionName, simplifyArguments, toString, typeCheck
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, clearStreamabilityData, computeDependencies, computeStaticProperties, doPromotion, dynamicError, evaluateAsString, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getConfiguration, getConstructType, getContainer, getDependencies, getEvaluationMethod, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLocationId, getObjectName, getPosture, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getSweep, getSystemId, hasVariableBinding, identityHashCode, implementsStaticTypeCheck, isIdentical, isSubtreeExpression, isUpdatingExpression, isVacuousExpression, iterate, iterateEvents, makeStreamingAdjunct, markTailFunctionCalls, operandList, process, resetLocalStaticProperties, setContainer, setEvaluationMethod, setFiltered, setFlattened, setLocationId, setPostureAndSweep, simplify, staticTypeCheck, suppressValidation, toPattern, toStreamingPattern, typeError, unordered
public void checkArguments(ExpressionVisitor visitor) throws XPathException
checkArguments
in class SystemFunctionCall
visitor
- the expression visitorXPathException
- if the arguments are incorrectpublic Expression optimize(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
This method is called after all references to functions and variables have been resolved to the declaration of the function or variable, and after all type checking has been done.
optimize
in class SystemFunctionCall
visitor
- an expression visitorcontextItemType
- the static type of "." at the point where this expression is invoked.
The parameter is set to null if it is known statically that the context item will be undefined.
If the type of the context item is not known statically, the argument is set to
Type.ITEM_TYPE
XPathException
- if an error is discovered during this phase
(typically a type error)public boolean isNegatable(ExpressionVisitor visitor)
isNegatable
in interface Negatable
public Expression negate()
public static Expression rewriteEffectiveBooleanValue(Expression exp, ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException
exp
- the expression whose EBV is to be evaluatedvisitor
- an expression visitorcontextItemType
- the type of the context item for this expressionXPathException
- if static errors are foundpublic BooleanValue evaluateItem(XPathContext context) throws XPathException
evaluateItem
in class Expression
context
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic boolean effectiveBooleanValue(XPathContext c) throws XPathException
effectiveBooleanValue
in class Expression
c
- The context in which the expression is to be evaluatedXPathException
- if any dynamic error occurs evaluating the
expressionpublic BooleanValue call(XPathContext c, Sequence[] arguments) throws XPathException
Callable
call
in interface Callable
c
- the dynamic evaluation contextarguments
- the values of the arguments, supplied as Sequences.
Generally it is advisable, if calling iterate() to process a supplied sequence, to
call it only once; if the value is required more than once, it should first be converted
to a GroundedValue
by calling the utility methd
SequenceTool.toGroundedValue().
If the expected value is a single item, the item should be obtained by calling
Sequence.head(): it cannot be assumed that the item will be passed as an instance of
Item
or AtomicValue
.
It is the caller's responsibility to perform any type conversions required to convert arguments to the type expected by the callee. An exception is where this Callable is explicitly an argument-converting wrapper around the original Callable.
XPathException
- if a dynamic error occurs during the evaluation of the expressionpublic ExpressionCompiler getExpressionCompiler()
getExpressionCompiler
in class Expression
public BooleanFnAdjunct getStreamingAdjunct()
getStreamingAdjunct
in class Expression
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.