Class IntegerAverageOperator

java.lang.Object
tools.refinery.interpreter.matchers.aggregators.IntegerAverageOperator
All Implemented Interfaces:
IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>

public class IntegerAverageOperator extends Object implements IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
Since:
2.0
  • Field Details

  • Method Details

    • getShortDescription

      public String getShortDescription()
      Description copied from interface: IMultisetAggregationOperator
      A textual description of the operator.
      Specified by:
      getShortDescription in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
    • getName

      public String getName()
      Description copied from interface: IMultisetAggregationOperator
      A name or identifier of the operator.
      Specified by:
      getName in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
    • createNeutral

      public tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> createNeutral()
      Specified by:
      createNeutral in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Returns:
      the neutral element, i.e. the interim result of aggregating an empty multiset.
    • isNeutral

      public boolean isNeutral(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> result)
      Specified by:
      isNeutral in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Returns:
      true if the interim result is equivalent to the neutral element, as if there are no values in the multiset. Must return true if the multiset is empty.
    • update

      public tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> update(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> oldResult, Integer updateValue, boolean isInsertion)
      Specified by:
      update in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Returns:
      an updated intermediate result, changed to reflect that a given object was added to / removed from the multiset (as indicated by the parameter isInsertion)
    • getAggregate

      public Double getAggregate(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> result)
      Specified by:
      getAggregate in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Returns:
      the aggregate result obtained from the given intermediate result. May be null to indicate that the current multiset cannot be aggregated (e.g. 0 elements have no minimum).
    • aggregateStream

      public Double aggregateStream(Stream<Integer> stream)
      Description copied from interface: IMultisetAggregationOperator
      Calculates the aggregate results from a given stream of values; all values are considered as inserted
      Specified by:
      aggregateStream in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Returns:
      the aggregate result, or null if no result can be calculated (e.g. because of an empty stream)
    • clone

      public tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> clone(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer> original)
      Description copied from interface: IMultisetAggregationOperator
      Clones the given accumulator (with all its internal contents).
      Specified by:
      clone in interface IMultisetAggregationOperator<Integer,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Integer>,Double>
      Since:
      2.4