com.saxonica.functions.hof
Class DynamicFunctionCallDefinition.DynamicFunctionCall

java.lang.Object
  extended by net.sf.saxon.lib.ExtensionFunctionCall
      extended by com.saxonica.functions.hof.DynamicFunctionCallDefinition.DynamicFunctionCall
All Implemented Interfaces:
Serializable
Enclosing class:
DynamicFunctionCallDefinition

public static class DynamicFunctionCallDefinition.DynamicFunctionCall
extends ExtensionFunctionCall

See Also:
Serialized Form

Constructor Summary
DynamicFunctionCallDefinition.DynamicFunctionCall()
           
 
Method Summary
 SequenceIterator call(SequenceIterator[] arguments, XPathContext context)
          Evaluate this function call at run-time
 Expression rewrite(StaticContext context, Expression[] arguments)
          Rewrite the function call.
 
Methods inherited from class net.sf.saxon.lib.ExtensionFunctionCall
copyLocalData, effectiveBooleanValue, getContainer, getDefinition, getExecutable, setDefinition, supplyStaticContext
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DynamicFunctionCallDefinition.DynamicFunctionCall

public DynamicFunctionCallDefinition.DynamicFunctionCall()
Method Detail

rewrite

public Expression rewrite(StaticContext context,
                          Expression[] arguments)
                   throws XPathException
Rewrite the function call. This method is called at compile time. It gives the implementation an opportunity to replace itself with an optimized implementation that returns the same result.

There is also an opportunity to perform static checking at this stage and to throw an error if the arguments are invalid.

Overrides:
rewrite in class ExtensionFunctionCall
Parameters:
context - The static context in which the function call appears. The method must not modify the static context.
arguments - The XPath expressions supplied in the call to this function. This method is called after type-checking, so these expressions may have been modified by adding atomization operators or type-checking operations, for example.
Returns:
an expression to be evaluated at run-time in place of this function call. Return null if no rewriting is required and the function call should be used unchanged. Return a Literal representing the result of the function call if the function call can be precomputed at compile time
Throws:
XPathException - if the implementation is able to detect a static error in the way the function is being called (for example it might require that the types of the arguments are consistent with each other).

call

public SequenceIterator call(SequenceIterator[] arguments,
                             XPathContext context)
                      throws XPathException
Evaluate this function call at run-time

Specified by:
call in class ExtensionFunctionCall
Parameters:
arguments - The values of the arguments to the function call. Each argument value (which is in general a sequence) is supplied in the form of an iterator over the items in the sequence. If required, the supplied sequence can be materialized by calling, for example, new SequenceExtent(arguments[i]). If the argument is always a singleton, then the single item may be obtained by calling arguments[i].next(). The implementation is not obliged to read all the items in each SequenceIterator if they are not required to compute the result; but if any SequenceIterator is not read to completion, it is good practice to call its close() method.
context - The XPath dynamic evaluation context
Returns:
an iterator over the results of the function. If the result is a single item, it can be returned in the form of a SingletonIterator. If the result is an empty sequence, the method should return EmptyIterator.getInstance()
Throws:
XPathException - if a dynamic error occurs during evaluation of the function. The Saxon run-time code will add information about the error location.


Copyright (c) 2004-2010 Saxonica Limited. All rights reserved.