Class DoubleAverageOperator

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

public class DoubleAverageOperator extends Object implements IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,Double>
    • getName

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

      public tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double> createNeutral()
      Specified by:
      createNeutral in interface IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double> result)
      Specified by:
      isNeutral in interface IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double> update(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double> oldResult, Double updateValue, boolean isInsertion)
      Specified by:
      update in interface IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double> result)
      Specified by:
      getAggregate in interface IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double> 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<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,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<Double> clone(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double> original)
      Description copied from interface: IMultisetAggregationOperator
      Clones the given accumulator (with all its internal contents).
      Specified by:
      clone in interface IMultisetAggregationOperator<Double,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Double>,Double>
      Since:
      2.4