Class ExtremumOperator<T extends Comparable<T>>
java.lang.Object
tools.refinery.interpreter.matchers.aggregators.ExtremumOperator<T>
- All Implemented Interfaces:
IMultisetAggregationOperator<T, SortedMap<T,Integer>, T>
public class ExtremumOperator<T extends Comparable<T>>
extends Object
implements IMultisetAggregationOperator<T, SortedMap<T,Integer>, T>
Incrementally computes the minimum or maximum of java.lang.Comparable values, using the default comparison
- Since:
- 1.4
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionaggregateStream(Stream<T> stream) Calculates the aggregate results from a given stream of values; all values are considered as insertedClones the given accumulator (with all its internal contents).getAggregate(SortedMap<T, Integer> result) static <T extends Comparable<T>>
ExtremumOperator<T> getMax()static <T extends Comparable<T>>
ExtremumOperator<T> getMin()getName()A name or identifier of the operator.A textual description of the operator.booleanMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface IMultisetAggregationOperator
combine, contains, prettyPrint
-
Method Details
-
getMin
-
getMax
-
getShortDescription
Description copied from interface:IMultisetAggregationOperatorA textual description of the operator.- Specified by:
getShortDescriptionin interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>
-
getName
Description copied from interface:IMultisetAggregationOperatorA name or identifier of the operator.- Specified by:
getNamein interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>
-
createNeutral
- Specified by:
createNeutralin interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- Returns:
- the neutral element, i.e. the interim result of aggregating an empty multiset.
- Since:
- 2.0
-
isNeutral
- Specified by:
isNeutralin interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- 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.
- Since:
- 2.0
-
update
public SortedMap<T,Integer> update(SortedMap<T, Integer> oldResult, T updateValue, boolean isInsertion) - Specified by:
updatein interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- 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)
- Since:
- 2.0
-
getAggregate
- Specified by:
getAggregatein interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- 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).
- Since:
- 2.0
-
aggregateStream
Description copied from interface:IMultisetAggregationOperatorCalculates the aggregate results from a given stream of values; all values are considered as inserted- Specified by:
aggregateStreamin interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- Returns:
- the aggregate result, or null if no result can be calculated (e.g. because of an empty stream)
- Since:
- 2.0
-
clone
Description copied from interface:IMultisetAggregationOperatorClones the given accumulator (with all its internal contents).- Specified by:
clonein interfaceIMultisetAggregationOperator<T extends Comparable<T>, SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>- Since:
- 2.4
-