Package net.sf.saxon.functions
Class BooleanFn
java.lang.Object
net.sf.saxon.expr.Expression
net.sf.saxon.expr.FunctionCall
net.sf.saxon.functions.SystemFunction
net.sf.saxon.functions.BooleanFn
- All Implemented Interfaces:
Serializable,SourceLocator,LocationProvider,SaxonLocator,EvaluableItem,Negatable,SequenceIterable,InstructionInfo,Locator
This class supports the XPath functions boolean(), not(), true(), and false()
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intFields inherited from class net.sf.saxon.functions.SystemFunction
operationFields inherited from class net.sf.saxon.expr.FunctionCall
argumentFields inherited from class net.sf.saxon.expr.Expression
EVALUATE_METHOD, ITERATE_METHOD, locationId, PROCESS_METHOD, staticProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckArguments(ExpressionVisitor visitor) Static analysis: prevent sorting of the argumentbooleanEvaluate the effective boolean valueevaluateItem(XPathContext context) Evaluate the functionbooleanisNegatable(ExpressionVisitor visitor) Check whether this specific instance of the expression is negatablenegate()Create an expression that returns the negation of this expressionoptimize(ExpressionVisitor visitor, ItemType contextItemType) Perform optimisation of an expression and its subexpressions.static ExpressionrewriteEffectiveBooleanValue(Expression exp, ExpressionVisitor visitor, ItemType contextItemType) Optimize an expression whose effective boolean value is requiredsimplify(ExpressionVisitor visitor) Simplify the function call.Methods inherited from class net.sf.saxon.functions.SystemFunction
addContextDocumentArgument, addDocToPathMap, computeCardinality, computeSpecialProperties, copy, getDetails, getErrorCodeForTypeErrors, getItemType, getRequiredType, makeSystemFunction, setDetails, useContextItemAsDefaultMethods inherited from class net.sf.saxon.expr.FunctionCall
addExternalFunctionCallToPathMap, checkArgumentCount, equals, explain, getArguments, getDisplayName, getFunctionName, getNumberOfArguments, hashCode, iterateSubExpressions, preEvaluate, promote, replaceSubExpression, setArguments, setFunctionName, simplifyArguments, toString, typeCheckMethods inherited from class net.sf.saxon.expr.Expression
addToPathMap, adoptChildExpression, checkForUpdatingSubexpressions, checkPermittedContents, computeDependencies, computeStaticProperties, display, doPromotion, dynamicError, evaluateAsString, evaluatePendingUpdates, explain, findParentOf, getCardinality, getColumnNumber, getColumnNumber, getConstructType, getContainer, getDependencies, getExecutable, getHostLanguage, getImplementationMethod, getIntrinsicDependencies, getLineNumber, getLineNumber, getLocationId, getLocationProvider, getObjectName, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getSystemId, getSystemId, hasLoopingSubexpression, implementsStaticTypeCheck, isUpdatingExpression, iterate, iterateEvents, markTailFunctionCalls, process, resetLocalStaticProperties, setContainer, setFiltered, setFlattened, setLocationId, staticTypeCheck, suppressValidation, typeError
-
Field Details
-
BOOLEAN
public static final int BOOLEAN- See Also:
-
NOT
public static final int NOT- See Also:
-
TRUE
public static final int TRUE- See Also:
-
FALSE
public static final int FALSE- See Also:
-
-
Constructor Details
-
BooleanFn
public BooleanFn()
-
-
Method Details
-
simplify
Simplify the function call. Default method is to simplify each of the supplied arguments and evaluate the function if all are now known.- Overrides:
simplifyin classFunctionCall- Parameters:
visitor- an expression visitor- Returns:
- the simplified expression
- Throws:
XPathException- if an error is discovered during expression rewriting
-
checkArguments
Static analysis: prevent sorting of the argument- Overrides:
checkArgumentsin classSystemFunction- Parameters:
visitor- the expression visitor- Throws:
XPathException
-
optimize
public Expression optimize(ExpressionVisitor visitor, ItemType contextItemType) throws XPathException Perform optimisation of an expression and its subexpressions.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.
- Overrides:
optimizein classSystemFunction- Parameters:
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 toType.ITEM_TYPE- Returns:
- the original expression, rewritten if appropriate to optimize execution
- Throws:
XPathException- if an error is discovered during this phase (typically a type error)
-
isNegatable
Check whether this specific instance of the expression is negatable- Specified by:
isNegatablein interfaceNegatable- Returns:
- true if it is
-
negate
Create an expression that returns the negation of this expression -
rewriteEffectiveBooleanValue
public static Expression rewriteEffectiveBooleanValue(Expression exp, ExpressionVisitor visitor, ItemType contextItemType) throws XPathException Optimize an expression whose effective boolean value is required- Parameters:
exp- the expression whose EBV is to be evaluatedvisitor- an expression visitorcontextItemType- the type of the context item for this expression- Returns:
- an expression that returns the EBV of exp, or null if no optimization was possible
- Throws:
XPathException- if static errors are found
-
evaluateItem
Evaluate the function- Specified by:
evaluateItemin interfaceEvaluableItem- Overrides:
evaluateItemin classExpression- Parameters:
context- The context in which the expression is to be evaluated- Returns:
- the node or atomic value that results from evaluating the expression; or null to indicate that the result is an empty sequence
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-
effectiveBooleanValue
Evaluate the effective boolean value- Overrides:
effectiveBooleanValuein classExpression- Parameters:
c- The context in which the expression is to be evaluated- Returns:
- the effective boolean value
- Throws:
XPathException- if any dynamic error occurs evaluating the expression
-