Class Evaluator


  • public abstract class Evaluator
    extends java.lang.Object
    An Evaluator evaluates an expression to return a sequence
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static Evaluator EAGER_SEQUENCE
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated eagerly.
      static Evaluator EMPTY_SEQUENCE
      An evaluator that always returns the empty sequence
      static Evaluator LAZY_SEQUENCE
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use.
      static Evaluator LAZY_TAIL
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use.
      static Evaluator LITERAL
      An evaluator for arguments supplied as a literal
      static Evaluator MAKE_INDEXED_VARIABLE
      An evaluator for an expression that makes use of an indexed variable
      static Evaluator MEMO_CLOSURE
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      static Evaluator MEMO_SEQUENCE
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      static Evaluator OPTIONAL_ITEM
      A (default) evaluator for arguments supplied as an expression that will return either a singleton item, or an empty sequence
      static Evaluator PROCESS
      A push-mode evaluator for an expression
      static Evaluator SHARED_APPEND
      An evaluator for "shared append" expressions: used when the argument to a function is a block potentially containing a recursive call.
      static Evaluator SINGLE_ITEM
      A (default) evaluator for arguments supplied as an expression that will always return a singleton item
      static Evaluator SINGLETON_CLOSURE
      An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      static Evaluator STREAMING_ARGUMENT
      An evaluator for the first (streamed) argument of a streamable function call.
      static Evaluator SUPPLIED_PARAMETER
      An evaluator for a reference to an external parameter value
      static Evaluator VARIABLE
      An evaluator for arguments supplied as a variable reference
    • Constructor Summary

      Constructors 
      Constructor Description
      Evaluator()  
    • Field Detail

      • EMPTY_SEQUENCE

        public static final Evaluator EMPTY_SEQUENCE
        An evaluator that always returns the empty sequence
      • LITERAL

        public static final Evaluator LITERAL
        An evaluator for arguments supplied as a literal
      • VARIABLE

        public static final Evaluator VARIABLE
        An evaluator for arguments supplied as a variable reference
      • SUPPLIED_PARAMETER

        public static final Evaluator SUPPLIED_PARAMETER
        An evaluator for a reference to an external parameter value
      • SINGLE_ITEM

        public static final Evaluator SINGLE_ITEM
        A (default) evaluator for arguments supplied as an expression that will always return a singleton item
      • OPTIONAL_ITEM

        public static final Evaluator OPTIONAL_ITEM
        A (default) evaluator for arguments supplied as an expression that will return either a singleton item, or an empty sequence
      • LAZY_SEQUENCE

        public static final Evaluator LAZY_SEQUENCE
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use. This is appropriate when calling a function which might not use the value, or might not use all of it. It returns a LazySequence, which can only be read once, so this is only suitable for use when calling a function that can be trusted to read the argument once only.
      • MEMO_SEQUENCE

        public static final Evaluator MEMO_SEQUENCE
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      • MEMO_CLOSURE

        public static final Evaluator MEMO_CLOSURE
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      • SINGLETON_CLOSURE

        public static final Evaluator SINGLETON_CLOSURE
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use, and where the value might be needed more than once.
      • EAGER_SEQUENCE

        public static final Evaluator EAGER_SEQUENCE
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated eagerly. This is appropriate when it is known that the function will always use the entire value, or when it will use it more than once.
      • SHARED_APPEND

        public static final Evaluator SHARED_APPEND
        An evaluator for "shared append" expressions: used when the argument to a function is a block potentially containing a recursive call.
      • STREAMING_ARGUMENT

        public static final Evaluator STREAMING_ARGUMENT
        An evaluator for the first (streamed) argument of a streamable function call.
      • MAKE_INDEXED_VARIABLE

        public static final Evaluator MAKE_INDEXED_VARIABLE
        An evaluator for an expression that makes use of an indexed variable
      • PROCESS

        public static final Evaluator PROCESS
        A push-mode evaluator for an expression
      • LAZY_TAIL

        public static final Evaluator LAZY_TAIL
        An evaluator for arguments that in general return a sequence, where the sequence is evaluated lazily on first use. This is appropriate when calling a function which might not use the value, or might not use all of it. It returns a LazySequence, which can only be read once, so this is only suitable for use when calling a function that can be trusted to read the argument once only.
    • Constructor Detail

      • Evaluator

        public Evaluator()
    • Method Detail

      • evaluate

        public abstract Sequence evaluate​(Expression expr,
                                          XPathContext context)
                                   throws XPathException
        Evaluate an expression to return a sequence
        Parameters:
        expr - the expression to be evaluated
        context - the dynamic context for evaluation
        Returns:
        the result of the evaluation
        Throws:
        XPathException - if any dynamic error occurs during the evaluation
      • getEvaluationMode

        public abstract EvaluationMode getEvaluationMode()
        Get an integer code identifying this evaluator (for use in the SEF file). The codes are chosen to be compatible with argument evaluation modes in earlier releases in the interests of SEF compatibility.