public abstract class SystemFunction extends AbstractFunction
Constructor and Description |
---|
SystemFunction() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o)
Determine whether two functions are equivalent
|
void |
export(ExpressionPresenter out)
Diagnostic print of expression structure.
|
void |
exportAttributes(ExpressionPresenter out)
Export any context attributes held within the SystemFunction object.
|
int |
getArity()
Get the arity of the function (the number of arguments).
|
int |
getCardinality(Expression[] args)
Get the cardinality, given knowledge of the actual arguments
|
protected NodeInfo |
getContextNode(XPathContext context)
Helper method for subclasses: get the context item if it is a node, throwing appropriate errors
if not
|
String |
getDescription()
Get a description of this function for use in error messages.
|
StandardFunction.Entry |
getDetails()
Get the details of the function signature
|
String |
getErrorCodeForTypeErrors()
Return the error code to be used for type errors.
|
ExpressionCompiler |
getExpressionCompiler()
Return the bytecode compiler for a static call to the function in question.
|
FunctionItemType |
getFunctionItemType()
Get the item type of the function item
|
StructuredQName |
getFunctionName()
Get the qualified name of the function being called
|
IntegerValue[] |
getIntegerBounds()
For a function that returns an integer or a sequence of integers, get
a lower and upper bound on the values of the integers that may be returned, from
static analysis.
|
OperandRole[] |
getOperandRoles()
Get the roles of the arguments, for the purposes of streaming
|
SequenceType |
getRequiredType(int arg)
Get the required type of the nth argument
|
ItemType |
getResultItemType()
Determine the item type of the value returned by the function
|
ItemType |
getResultItemType(Expression[] args)
Get the return type, given knowledge of the actual arguments
|
RetainedStaticContext |
getRetainedStaticContext()
Get the static context in which the function operates, for use with functions whose result
depends on the static context
|
int |
getSpecialProperties(Expression[] arguments)
Determine the special properties of this function.
|
String |
getStaticBaseUriString() |
StreamingAdjunct |
getStreamingAdjunct()
Get a class that supports streamed evaluation of this expression
|
void |
importAttributes(Properties attributes)
Import any attributes found in the export file, that is, any attributes output using
the exportAttributes method
|
static Expression |
makeCall(String name,
RetainedStaticContext rsc,
Expression... arguments)
Make a system function call (one in the standard function namespace).
|
static SystemFunction |
makeFunction(String name,
RetainedStaticContext rsc,
int arity)
Make a system function item (one in the standard function namespace).
|
Expression |
makeFunctionCall(Expression... arguments)
Make an expression that either calls this function, or that is equivalent to a call
on this function
|
Expression |
makeOptimizedFunctionCall(ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo,
Expression... arguments)
Allow the function to create an optimized call based on the values of the actual arguments
|
protected Sequence |
resultIfEmpty(int arg)
Ask if the function always returns a known result when one of the arguments is an empty sequence
|
void |
setArity(int arity)
Set the arity of the function
|
void |
setDetails(StandardFunction.Entry entry)
Set the details of this type of function
|
void |
setRetainedStaticContext(RetainedStaticContext retainedStaticContext)
Set the static context in which the function operates, for use with functions whose result
depends on the static context
|
void |
supplyTypeInformation(ExpressionVisitor visitor,
ContextItemStaticInfo contextItemType,
Expression[] arguments)
Method called during static type checking.
|
Expression |
typeCheckCaller(FunctionCall caller,
ExpressionVisitor visitor,
ContextItemStaticInfo contextInfo)
Typecheck a call on this function
|
atomize, deepEquals, effectiveBooleanValue, getStringValue, getStringValueCS, isArray, isMap, optimize, simplify, typeCheck
getLength, head, itemAt, iterate, reduce, subsequence
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLength, head, itemAt, reduce, subsequence
public static Expression makeCall(String name, RetainedStaticContext rsc, Expression... arguments)
name
- The local name of the function.rsc
- Necessary information about the static contextarguments
- the arguments to the function callpublic static SystemFunction makeFunction(String name, RetainedStaticContext rsc, int arity)
name
- The local name of the function.rsc
- Necessary information about the static contextarity
- the arity of the functionpublic Expression makeFunctionCall(Expression... arguments)
arguments
- the supplied arguments to the function callpublic void setArity(int arity)
arity
- the number of argumentspublic Expression makeOptimizedFunctionCall(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression... arguments) throws XPathException
visitor
- the expression visitorcontextInfo
- information about the context itemarguments
- the supplied arguments to the function call. Note: modifying the contents
of this array should not be attempted, it is likely to have no effect.XPathException
- if an error is detectedprotected Sequence resultIfEmpty(int arg)
arg
- the argument whose value is an empty sequence (counting from zero)public RetainedStaticContext getRetainedStaticContext()
public void setRetainedStaticContext(RetainedStaticContext retainedStaticContext)
retainedStaticContext
- the retained static contextpublic void setDetails(StandardFunction.Entry entry)
entry
- information giving details of the function signature and other function propertiespublic StandardFunction.Entry getDetails()
public StructuredQName getFunctionName()
public String getDescription()
public int getArity()
public OperandRole[] getOperandRoles()
getOperandRoles
in interface Function
getOperandRoles
in class AbstractFunction
public IntegerValue[] getIntegerBounds()
public void supplyTypeInformation(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType, Expression[] arguments) throws XPathException
visitor
- an expression visitor, providing access to the static context and configurationcontextItemType
- information about whether the context item is set, and what its type isarguments
- the expressions appearing as arguments in the function callXPathException
public boolean equals(Object o)
public String getErrorCodeForTypeErrors()
public SequenceType getRequiredType(int arg)
arg
- the number of the argument whose type is requested, zero-basedpublic ItemType getResultItemType()
public FunctionItemType getFunctionItemType()
public ItemType getResultItemType(Expression[] args)
args
- the actual arguments suppliedpublic int getCardinality(Expression[] args)
args
- the actual arguments suppliedpublic int getSpecialProperties(Expression[] arguments)
arguments
- the actual arguments supplied in a call to the functionprotected 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 void export(ExpressionPresenter out)
export
in interface Function
export
in class AbstractFunction
public Expression typeCheckCaller(FunctionCall caller, ExpressionVisitor visitor, ContextItemStaticInfo contextInfo) throws XPathException
XPathException
public String getStaticBaseUriString()
public void exportAttributes(ExpressionPresenter out)
out
- the export destinationpublic void importAttributes(Properties attributes) throws XPathException
attributes
- the attributes, as a properties objectXPathException
public ExpressionCompiler getExpressionCompiler()
public StreamingAdjunct getStreamingAdjunct()
Copyright (c) 2004-2014 Saxonica Limited. All rights reserved.