Package net.sf.saxon.functions
Class AbstractFunction
- java.lang.Object
-
- net.sf.saxon.functions.AbstractFunction
-
- All Implemented Interfaces:
Callable
,Function
,GroundedValue
,Item
,Sequence
- Direct Known Subclasses:
AtomicConstructorFunction
,CallableFunction
,CoercedFunction
,CurriedFunction
,ListConstructorFunction
,OriginalFunction
,SystemFunction
,SystemFunctionWithBoundContextItem
,UnionConstructorFunction
,UnresolvedXQueryFunctionItem
,UserFunctionReference.BoundUserFunction
public abstract class AbstractFunction extends java.lang.Object implements Function
Abstract superclass (and factory class) for implementations of Function
-
-
Constructor Summary
Constructors Constructor Description AbstractFunction()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AtomicSequence
atomize()
Atomize the item.boolean
deepEquals(Function 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
effectiveBooleanValue()
Get the effective boolean value of the function itemvoid
export(ExpressionPresenter out)
Output information about this function item to the diagnostic explain() outputAnnotationList
getAnnotations()
Get the function annotations (as defined in XQuery).OperandRole[]
getOperandRoles()
Get the roles of the arguments, for the purposes of streamingjava.lang.String
getStringValue()
Get the string value of the functionjava.lang.CharSequence
getStringValueCS()
Get the string value of the functionboolean
isArray()
Ask whether this function is an arrayboolean
isMap()
Ask whether this function is a mapboolean
isTrustedResultType()
Check that result type is SystemFunction or AtomicConstructorFunctionXPathContext
makeNewContext(XPathContext callingContext, ContextOriginator originator)
Prepare an XPathContext object for evaluating the functionvoid
simplify()
void
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.Function
call, getArity, getDescription, getFunctionItemType, getFunctionName, getGenre, toShortString
-
Methods inherited from interface net.sf.saxon.om.GroundedValue
asIterable, concatenate, containsNode, materialize
-
Methods inherited from interface net.sf.saxon.om.Item
getLength, head, isStreamed, itemAt, iterate, reduce, subsequence
-
Methods inherited from interface net.sf.saxon.om.Sequence
makeRepeatable
-
-
-
-
Method Detail
-
getOperandRoles
public OperandRole[] getOperandRoles()
Get the roles of the arguments, for the purposes of streaming- Specified by:
getOperandRoles
in interfaceFunction
- Returns:
- an array of OperandRole objects, one for each argument
-
atomize
public AtomicSequence atomize() throws XPathException
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
-
isMap
public boolean isMap()
Ask whether this function is a map
-
getStringValue
public java.lang.String getStringValue()
Get the string value of the function- Specified by:
getStringValue
in interfaceGroundedValue
- Specified by:
getStringValue
in interfaceItem
- Returns:
- the string value of the item
- Throws:
java.lang.UnsupportedOperationException
- (the string value of a function is not defined)- See Also:
Item.getStringValueCS()
-
getStringValueCS
public java.lang.CharSequence getStringValueCS()
Get the string value of the function- Specified by:
getStringValueCS
in interfaceGroundedValue
- Specified by:
getStringValueCS
in interfaceItem
- Returns:
- the string value of the item
- Throws:
java.lang.UnsupportedOperationException
- (the string value of a function is not defined)- See Also:
Item.getStringValue()
-
getAnnotations
public AnnotationList getAnnotations()
Description copied from interface:Function
Get the function annotations (as defined in XQuery). Returns an empty list if there are no function annotations.- Specified by:
getAnnotations
in interfaceFunction
- Returns:
- the function annotations
-
effectiveBooleanValue
public boolean effectiveBooleanValue() throws XPathException
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
public void simplify() throws XPathException
- 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
public XPathContext makeNewContext(XPathContext callingContext, ContextOriginator originator)
Prepare an XPathContext object for evaluating the function- Specified by:
makeNewContext
in interfaceFunction
- Parameters:
callingContext
- the XPathContext of the function calling expressionoriginator
-- 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(Function 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 interfaceFunction
- 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
-
export
public void export(ExpressionPresenter out) throws XPathException
Output information about this function item to the diagnostic explain() output- Specified by:
export
in interfaceFunction
- Throws:
XPathException
-
isTrustedResultType
public boolean isTrustedResultType()
Check that result type is SystemFunction or AtomicConstructorFunction- Specified by:
isTrustedResultType
in interfaceFunction
-
-