Annotation Interface MvEvaluator


@Target(METHOD) @Retention(SOURCE) public @interface MvEvaluator
Implement an evaluator for a function reducing multivalued fields into a single valued field from a static process method.

Annotated methods can have three "shapes":

  • pairwise processing
  • accumulator processing
  • position at a time processing

Pairwise processing is generally simpler and looks like int process(int current, int next). Use it when the result is a primitive.

Accumulator processing is a bit more complex and looks like void process(State state, int v) and it useful when you need to accumulate more data than fits in a primitive result. Think Kahan summation.

Position at a time processing just hands the block, start index, and end index to the processor and is useful when none of the others fit. It looks like long process(LongBlock block, int start, int end) and is the most flexible, but the choice where the code generation does the least work for you. You should only use this if pairwise and state based processing aren't options.

Pairwise and accumulator processing support a finish = "finish_method" parameter on the annotation which is used to, well, "finish" processing after all values have been received. Again, think reading the sum from the Kahan summation. Or doing the division for an "average" operation. This method is required for accumulator processing.

  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Optional method called to process blocks whose values are sorted in ascending order.
    Extra part of the name of the evaluator.
    Optional method called to convert state into result.
    Optional method called to process single valued fields.
    Class<? extends Exception>[]
    Exceptions thrown by the process method to catch and convert into a warning and turn into a null value.
  • Element Details

    • extraName

      String extraName
      Extra part of the name of the evaluator. Use for disambiguating when there are multiple ways to evaluate a function.
      Default:
      ""
    • finish

      String finish
      Optional method called to convert state into result.
      Default:
      ""
    • single

      String single
      Optional method called to process single valued fields. If this is missing then blocks containing only single valued fields will be returned exactly as is. If this is present then single valued fields will not call the process or finish function and instead just call this function.
      Default:
      ""
    • ascending

      String ascending
      Optional method called to process blocks whose values are sorted in ascending order.
      Default:
      ""
    • warnExceptions

      Class<? extends Exception>[] warnExceptions
      Exceptions thrown by the process method to catch and convert into a warning and turn into a null value.
      Default:
      {}