Class LongAverageOperator
java.lang.Object
tools.refinery.interpreter.matchers.aggregators.LongAverageOperator
- All Implemented Interfaces:
IMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, Double>
public class LongAverageOperator
extends Object
implements IMultisetAggregationOperator<Long,tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>,Double>
- Since:
- 2.0
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionaggregateStream
(Stream<Long> stream) Calculates the aggregate results from a given stream of values; all values are considered as insertedtools.refinery.interpreter.matchers.aggregators.AverageAccumulator
<Long> Clones the given accumulator (with all its internal contents).tools.refinery.interpreter.matchers.aggregators.AverageAccumulator
<Long> getAggregate
(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long> result) getName()
A name or identifier of the operator.A textual description of the operator.boolean
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator
<Long> update
(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long> oldResult, Long updateValue, boolean isInsertion) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface tools.refinery.interpreter.matchers.psystem.aggregations.IMultisetAggregationOperator
combine, contains, prettyPrint
-
Field Details
-
INSTANCE
-
-
Method Details
-
getShortDescription
Description copied from interface:IMultisetAggregationOperator
A textual description of the operator.- Specified by:
getShortDescription
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, Double>
-
getName
Description copied from interface:IMultisetAggregationOperator
A name or identifier of the operator.- Specified by:
getName
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, Double>
-
createNeutral
- Specified by:
createNeutral
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, 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<Long> result) - Specified by:
isNeutral
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, 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<Long> update(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long> oldResult, Long updateValue, boolean isInsertion) - Specified by:
update
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, 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<Long> result) - Specified by:
getAggregate
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, 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
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 interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, 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<Long> clone(tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long> original) Description copied from interface:IMultisetAggregationOperator
Clones the given accumulator (with all its internal contents).- Specified by:
clone
in interfaceIMultisetAggregationOperator<Long,
tools.refinery.interpreter.matchers.aggregators.AverageAccumulator<Long>, Double> - Since:
- 2.4
-