Class Reverse

All Implemented Interfaces:
Serializable, SourceLocator, LocationProvider, SaxonLocator, CallableExpression, InstructionInfo, Locator

public class Reverse extends SystemFunction implements CallableExpression
Implement XPath function fn:reverse()
See Also:
  • Constructor Details

    • Reverse

      public Reverse()
  • Method Details

    • getItemType

      public ItemType getItemType(TypeHierarchy th)
      Determine the item type of the value returned by the function
      Overrides:
      getItemType in class SystemFunction
      Parameters:
      th - the type hierarchy cache
      Returns:
      a value such as Type.STRING, Type.BOOLEAN, Type.NUMBER, Type.NODE, or Type.ITEM (meaning not known at compile time)
    • computeSpecialProperties

      public int computeSpecialProperties()
      Description copied from class: SystemFunction
      Determine the special properties of this expression. The general rule is that a system function call is non-creative if its return type is atomic, or if all its arguments are non-creative. This is overridden for the generate-id() function, which is considered creative if its operand is creative (because the result depends on the identity of the operand)
      Overrides:
      computeSpecialProperties in class SystemFunction
      Returns:
      the special properties, as a bit-significant integer
    • iterate

      public SequenceIterator iterate(XPathContext context) throws XPathException
      Description copied from class: Expression
      Return an Iterator to iterate over the values of a sequence. The value of every expression can be regarded as a sequence, so this method is supported for all expressions. This default implementation handles iteration for expressions that return singleton values: for non-singleton expressions, the subclass must provide its own implementation.
      Overrides:
      iterate in class Expression
      Parameters:
      context - supplies the context for evaluation
      Returns:
      a SequenceIterator that can be used to iterate over the result of the expression
      Throws:
      XPathException - if any dynamic error occurs evaluating the expression
    • getReverseIterator

      public static SequenceIterator getReverseIterator(SequenceIterator forwards) throws XPathException
      Throws:
      XPathException
    • effectiveBooleanValue

      public boolean effectiveBooleanValue(XPathContext context) throws XPathException
      Description copied from class: Expression
      Get the effective boolean value of the expression. This returns false if the value is the empty sequence, a zero-length string, a number equal to zero, or the boolean false. Otherwise it returns true.
      Overrides:
      effectiveBooleanValue in class Expression
      Parameters:
      context - The context in which the expression is to be evaluated
      Returns:
      the effective boolean value
      Throws:
      XPathException - if any dynamic error occurs evaluating the expression
    • call

      public SequenceIterator call(SequenceIterator[] arguments, XPathContext context) throws XPathException
      Description copied from interface: CallableExpression
      Evaluate the expression
      Specified by:
      call in interface CallableExpression
      Parameters:
      arguments - the values of the arguments, supplied as SequenceIterators
      context - the dynamic evaluation context
      Returns:
      the result of the evaluation, in the form of a SequenceIterator
      Throws:
      XPathException - if a dynamic error occurs during the evaluation of the expression