Package net.sf.saxon.functions
Class AbstractFunction
java.lang.Object
net.sf.saxon.functions.AbstractFunction
- All Implemented Interfaces:
Callable
,FunctionItem
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
AtomicConstructorFunction
,CallableFunction
,CoercedFunction
,CurriedFunction
,ListConstructorFunction
,OriginalFunction
,SystemFunction
,SystemFunctionWithBoundContextItem
,UnionConstructorFunction
,UnresolvedXQueryFunctionItem
,UserFunctionReference.BoundUserFunction
Abstract superclass (and factory class) for implementations of Function
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionatomize()
Atomize the item.boolean
deepEqual40
(FunctionItem other, XPathContext context, DeepEqual.DeepEqualOptions options) boolean
deepEquals
(FunctionItem other, XPathContext context, AtomicComparer comparer, int flags) Test whether this FunctionItem is deep-equal to another function item, under the rules of the deep-equal functionboolean
Get the effective boolean value of the function itemvoid
Output information about this function item to the diagnostic explain() outputGet the function annotations (as defined in XQuery).Get the roles of the arguments, for the purposes of streamingGet the string value of the functionboolean
isArray()
Ask whether this function is an arrayboolean
isMap()
Ask whether this function is a mapboolean
Check that result type is SystemFunction or AtomicConstructorFunctionmakeNewContext
(XPathContext callingContext, ContextOriginator originator) Prepare an XPathContext object for evaluating the functionvoid
simplify()
Provide a short string showing the contents of the item, suitable for use in error messagesvoid
typeCheck
(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) Type check the function (may modify it by adding code for converting the arguments)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.sf.saxon.om.FunctionItem
getArity, getDescription, getFunctionItemType, getFunctionName, getGenre, isSequenceVariadic
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
Methods inherited from interface net.sf.saxon.om.Item
getLength, getStringValue, head, isStreamed, itemAt, iterate, reduce, subsequence
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
Constructor Details
-
AbstractFunction
public AbstractFunction()
-
-
Method Details
-
getOperandRoles
Get the roles of the arguments, for the purposes of streaming- Specified by:
getOperandRoles
in interfaceFunctionItem
- Returns:
- an array of OperandRole objects, one for each argument
-
atomize
Atomize the item.- Specified by:
atomize
in interfaceItem
- Returns:
- the result of atomization
- Throws:
XPathException
- if atomization is not allowed for this kind of item
-
isArray
public boolean isArray()Ask whether this function is an array- Specified by:
isArray
in interfaceFunctionItem
- Returns:
- true if this function item is an array, otherwise false
-
isMap
public boolean isMap()Ask whether this function is a map- Specified by:
isMap
in interfaceFunctionItem
- Returns:
- true if this function item is a map, otherwise false
-
getUnicodeStringValue
Get the string value of the function- Specified by:
getUnicodeStringValue
in interfaceGroundedValue
- Specified by:
getUnicodeStringValue
in interfaceItem
- Returns:
- nothing; this method always throws an exception
- Throws:
UncheckedXPathException
- (the string value of a function is not defined)
-
getAnnotations
Description copied from interface:FunctionItem
Get the function annotations (as defined in XQuery). Returns an empty list if there are no function annotations.- Specified by:
getAnnotations
in interfaceFunctionItem
- Returns:
- the function annotations
-
effectiveBooleanValue
Get the effective boolean value of the function item- Specified by:
effectiveBooleanValue
in interfaceGroundedValue
- Returns:
- the effective boolean value
- Throws:
XPathException
- (the EBVof a function item is not defined)
-
simplify
- Throws:
XPathException
-
typeCheck
public void typeCheck(ExpressionVisitor visitor, ContextItemStaticInfo contextItemType) throws XPathException Type check the function (may modify it by adding code for converting the arguments)- Parameters:
visitor
- the expression visitor, supplies context informationcontextItemType
- the context item type at the point where the function definition appears- Throws:
XPathException
- if any failure (e.g. a type checking failure) occurs
-
makeNewContext
Prepare an XPathContext object for evaluating the function- Specified by:
makeNewContext
in interfaceFunctionItem
- Parameters:
callingContext
- the XPathContext of the function calling expressionoriginator
- the originator of the new context- Returns:
- a suitable context for evaluating the function (which may or may not be the same as the caller's context)
-
deepEquals
public boolean deepEquals(FunctionItem other, XPathContext context, AtomicComparer comparer, int flags) throws XPathException Test whether this FunctionItem is deep-equal to another function item, under the rules of the deep-equal function- Specified by:
deepEquals
in interfaceFunctionItem
- Parameters:
other
- the other function itemcontext
- the dynamic evaluation contextcomparer
- the object to perform the comparisonflags
- options for how the comparison is performed- Returns:
- true if the two function items are deep-equal
- Throws:
XPathException
- if the comparison cannot be performed
-
deepEqual40
public boolean deepEqual40(FunctionItem other, XPathContext context, DeepEqual.DeepEqualOptions options) throws XPathException - Specified by:
deepEqual40
in interfaceFunctionItem
- Throws:
XPathException
-
export
Output information about this function item to the diagnostic explain() output- Specified by:
export
in interfaceFunctionItem
- Parameters:
out
- the destination for the information- Throws:
XPathException
- if things go wrong
-
isTrustedResultType
public boolean isTrustedResultType()Check that result type is SystemFunction or AtomicConstructorFunction- Specified by:
isTrustedResultType
in interfaceFunctionItem
- Returns:
- true if the implementation can be trusted
-
toShortString
Description copied from interface:FunctionItem
Provide a short string showing the contents of the item, suitable for use in error messages- Specified by:
toShortString
in interfaceFunctionItem
- Specified by:
toShortString
in interfaceGroundedValue
- Specified by:
toShortString
in interfaceItem
- Returns:
- a depiction of the item suitable for use in error messages
-