com.xml_project.morganaxpath.functions
Interface XPathFunction


public interface XPathFunction

Serves as an interface for XPath functions (default and user written)


Method Summary
 boolean acceptsArity(int arity, float xpathVersion)
          Check whether function has the right arity
 XdmSequence call(java.util.List<XdmSequence> arguments, DynamicXQueryContext context)
          Does the actual function call by delivering an XdmSequence for the given arguments and context
 boolean dependsOnContextItem(int arity, float xpathVersion)
          Marks a function depending on the context item
 javax.xml.namespace.QName getName()
          Specifies name of the function
 SequenceType[] getParameterDefinitions()
          Returns the functions formal parameters.
 SequenceType getResultType(java.util.List<SequenceType> parameter)
          Returns the function's result type (relative to a parameter type=
 

Method Detail

getName

javax.xml.namespace.QName getName()
Specifies name of the function

Returns:
a QName for the function

acceptsArity

boolean acceptsArity(int arity,
                     float xpathVersion)
Check whether function has the right arity

Parameters:
arity - the arity for the function
xpathVersion - the used XPath version
Returns:
true, if the function has the desired arity in the given XPath version

dependsOnContextItem

boolean dependsOnContextItem(int arity,
                             float xpathVersion)
Marks a function depending on the context item

Parameters:
arity - the arity for the function
xpathVersion - the used XPath version
Returns:
true, if the function with that arity in the given XPath version depends on the context item

getParameterDefinitions

SequenceType[] getParameterDefinitions()
Returns the functions formal parameters.

Returns:
a SequenceType[] representing the formal parameters

getResultType

SequenceType getResultType(java.util.List<SequenceType> parameter)
Returns the function's result type (relative to a parameter type=

Parameters:
parameter - may be null
Returns:
the functions result type as SequenceType

call

XdmSequence call(java.util.List<XdmSequence> arguments,
                 DynamicXQueryContext context)
                 throws XPathException
Does the actual function call by delivering an XdmSequence for the given arguments and context

Parameters:
arguments - a list of XdmSequences with the actual parameters
context - the functions dynamic context
Returns:
the value obtained by applying the function to the arguments.
Throws:
XPathException - thrown, when an error occured.