public abstract class SystemFunctionCall extends FunctionCall implements Callable
Modifier and Type | Field and Description |
---|---|
protected int |
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 |
---|
SystemFunctionCall() |
Modifier and Type | Method and Description |
---|---|
protected void |
addContextDocumentArgument(int pos,
String augmentedName)
Add an implicit argument referring to the context document.
|
PathMap.PathMapNodeSet |
addDocToPathMap(PathMap pathMap,
PathMap.PathMapNodeSet pathMapNodes)
Add a representation of a doc() call or similar function to a PathMap.
|
void |
bindStaticContext(StaticContext env)
Bind aspects of the static context on which the particular function depends
|
void |
checkArguments(ExpressionVisitor visitor)
Method called during static type checking
|
int |
computeCardinality()
Determine the cardinality of the function.
|
int |
computeSpecialProperties()
Determine the special properties of this expression.
|
Expression |
copy()
Copy an expression.
|
static boolean |
equalOrNull(Object x,
Object y)
Return true if two objects are equal or if both are null
|
boolean |
equals(Object o)
Determine whether two expressions are equivalent
|
protected NodeInfo |
getContextNode(XPathContext context)
Helper method for subclasses: get the context item if it is a node, throwing appropriate errors
if not
|
Callable |
getConvertingCallable() |
NodeInfo |
getDefaultArgumentNode(XPathContext context,
Sequence[] arguments,
String funcName) |
StandardFunction.Entry |
getDetails()
Get the details of the function signature
|
String |
getErrorCodeForTypeErrors()
Return the error code to be used for type errors.
|
FunctionItemType |
getFunctionItemType(TypeHierarchy th)
Get the item type of the function item
|
int |
getImplementationMethod()
An implementation of Expression must provide at least one of the methods evaluateItem(), iterate(), or process().
|
ItemType |
getItemType()
Determine the item type of the value returned by the function
|
int |
getOperation() |
protected SequenceType |
getRequiredType(int arg)
Get the required type of the nth argument
|
static FunctionCall |
makeSystemFunction(String name,
Expression[] arguments)
Make a system function call (one in the standard function namespace).
|
Iterable<Operand> |
operands()
Get the immediate sub-expressions of this expression, with information about the relationship
of each expression to its parent expression.
|
Expression |
optimize(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType)
Perform optimisation of an expression and its subexpressions.
|
void |
setDetails(StandardFunction.Entry entry)
Set the details of this type of function
|
String |
toShortString()
Produce a short string identifying the expression for use in error messages
|
protected void |
useContextItemAsDefault(ExpressionVisitor visitor)
Set "." as the default value for the first and only argument.
|
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, effectiveBooleanValue, evaluateAsString, evaluateItem, evaluatePendingUpdates, explain, getCardinality, getColumnNumber, getConfiguration, getConstructType, getContainer, getDependencies, getEvaluationMethod, getExpressionCompiler, getHostLanguage, getIntegerBounds, getIntrinsicDependencies, getLineNumber, getLocationId, getObjectName, getPosture, getProperties, getProperty, getPublicId, getSlotsUsed, getSpecialProperties, getStreamability, getStreamingAdjunct, 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 Callable getConvertingCallable()
public static FunctionCall makeSystemFunction(String name, Expression[] arguments)
name
- The local name of the function.arguments
- the arguments to the function callpublic void setDetails(StandardFunction.Entry entry)
entry
- information giving details of the function signaturepublic StandardFunction.Entry getDetails()
public int getOperation()
public FunctionItemType getFunctionItemType(TypeHierarchy th)
th
- the type hierarchy cachepublic int getImplementationMethod()
getImplementationMethod
in class Expression
Expression.ITERATE_METHOD
or Expression.EVALUATE_METHOD
or
Expression.PROCESS_METHOD
public NodeInfo getDefaultArgumentNode(XPathContext context, Sequence[] arguments, String funcName) throws XPathException
XPathException
public void bindStaticContext(StaticContext env) throws XPathException
env
- the static context of the function callXPathException
- if execution with this static context will inevitably failpublic void checkArguments(ExpressionVisitor visitor) throws XPathException
checkArguments
in class FunctionCall
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 FunctionCall
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 Expression copy()
copy
in class Expression
public Iterable<Operand> operands()
operands
in class FunctionCall
public boolean equals(Object o)
equals
in class FunctionCall
public static boolean equalOrNull(Object x, Object y)
x
- the first objecty
- the second objectpublic String getErrorCodeForTypeErrors()
protected SequenceType getRequiredType(int arg)
arg
- the number of the argument whose type is requested, zero-basedpublic ItemType getItemType()
getItemType
in class Expression
public int computeCardinality()
computeCardinality
in class Expression
StaticProperty.ALLOWS_ZERO_OR_ONE
,
StaticProperty.EXACTLY_ONE
, StaticProperty.ALLOWS_ONE_OR_MORE
,
StaticProperty.ALLOWS_ZERO_OR_MORE
public int computeSpecialProperties()
computeSpecialProperties
in class Expression
protected final void useContextItemAsDefault(ExpressionVisitor visitor)
visitor
- the expression visitorprotected final void addContextDocumentArgument(int pos, String augmentedName) throws XPathException
pos
- the position of the argument whose default value is ".", zero-basedaugmentedName
- the name to be used for the function call with its extra argument.
There are some cases where user function calls cannot supply the argument directly (notably
unparsed-entity-uri() and unparsed-entity-public-id()) and in these cases a synthesized
function name is used for the new function call.XPathException
- if a static error is foundpublic PathMap.PathMapNodeSet addDocToPathMap(PathMap pathMap, PathMap.PathMapNodeSet pathMapNodes)
pathMap
- the PathMap to which the expression should be addedpathMapNodes
- the node in the PathMap representing the focus at the point where this expression
is called. Set to null if this expression appears at the top level.protected NodeInfo getContextNode(XPathContext context) throws XPathException
context
- the XPath dynamic contextXPathException
- if there is no context item or if the context item is not a nodepublic String toShortString()
FunctionCall
toShortString
in class FunctionCall
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.