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.boolean
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
-
Method Details
-
getMin
-
getMax
-
getShortDescription
Description copied from interface:IMultisetAggregationOperator
A textual description of the operator.- Specified by:
getShortDescription
in interfaceIMultisetAggregationOperator<T extends Comparable<T>,
SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>
-
getName
Description copied from interface:IMultisetAggregationOperator
A name or identifier of the operator.- Specified by:
getName
in interfaceIMultisetAggregationOperator<T extends Comparable<T>,
SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>>
-
createNeutral
- Specified by:
createNeutral
in 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:
isNeutral
in 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:
update
in 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:
getAggregate
in 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:IMultisetAggregationOperator
Calculates the aggregate results from a given stream of values; all values are considered as inserted- Specified by:
aggregateStream
in 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:IMultisetAggregationOperator
Clones the given accumulator (with all its internal contents).- Specified by:
clone
in interfaceIMultisetAggregationOperator<T extends Comparable<T>,
SortedMap<T extends Comparable<T>, Integer>, T extends Comparable<T>> - Since:
- 2.4
-