Class PositionAndLast

All Implemented Interfaces:
Callable, IContextAccessorFunction, IFunctionWithRetainedParameterNames, FunctionItem, GroundedValue, Item, Sequence
Direct Known Subclasses:
PositionAndLast.Last, PositionAndLast.Position

public abstract class PositionAndLast extends ContextAccessorFunction
  • Constructor Details

    • PositionAndLast

      public PositionAndLast()
  • Method Details

    • getNetCost

      public int getNetCost()
      Get an estimate of the net cost of evaluating the function, excluding the cost of evaluating its arguments. The result is 0 for very simple functions like position() and exists(), 1 by default, and higher values for particularly expensive functions.
      Overrides:
      getNetCost in class SystemFunction
      Returns:
      the estimated cost
    • bindContext

      public FunctionItem bindContext(XPathContext context)
      Bind a context item to appear as part of the function's closure. If this method has been called, the supplied context item will be used in preference to the context item at the point where the function is actually called.
      Parameters:
      context - the context to which the function applies. Must not be null.
    • supplyTypeInformation

      public void supplyTypeInformation(ExpressionVisitor visitor, ContextItemStaticInfo contextInfo, Expression[] arguments) throws XPathException
      Description copied from class: SystemFunction
      Method called during static type checking. This method may be implemented in subclasses so that functions can take advantage of knowledge of the types of the arguments that will be supplied.
      Overrides:
      supplyTypeInformation in class SystemFunction
      Parameters:
      visitor - an expression visitor, providing access to the static context and configuration
      contextInfo - information about whether the context item is set, and what its type is
      arguments - the expressions appearing as arguments in the function call
      Throws:
      XPathException - if an error is detected
    • isContextPossiblyUndefined

      public boolean isContextPossiblyUndefined()
      Ask whether the context item may possibly be undefined
      Returns:
      true if it might be undefined
    • evaluateItem

      public abstract Int64Value evaluateItem(XPathContext c) throws XPathException
      Evaluate in a general context
      Throws:
      XPathException
    • call

      public IntegerValue call(XPathContext context, Sequence[] arguments) throws XPathException
      Evaluate the expression
      Specified by:
      call in interface Callable
      Overrides:
      call in class ContextAccessorFunction
      Parameters:
      context - the dynamic evaluation context
      arguments - the values of the arguments, supplied as Sequences
      Returns:
      the result of the evaluation, in the form of a Sequence
      Throws:
      XPathException - if a dynamic error occurs during the evaluation of the expression