org.eclipse.viatra.query.runtime.matchers.aggregators

## Class ExtremumOperator<T extends java.lang.Comparable<T>>

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.aggregators.ExtremumOperator<T>

- All Implemented Interfaces:
    IMultisetAggregationOperator<T,java.util.SortedMap<T,java.lang.Integer>,T>

      public class ExtremumOperator<T extends java.lang.Comparable<T>>
      extends java.lang.Object
      implements IMultisetAggregationOperator<T,java.util.SortedMap<T,java.lang.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
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `ExtremumOperator.Extreme`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `T` | `aggregateStream(java.util.stream.Stream<T> stream)` Calculates the aggregate results from a given stream of values; all values are considered as inserted
    `java.util.SortedMap<T,java.lang.Integer>` | `clone(java.util.SortedMap<T,java.lang.Integer> original)` Clones the given accumulator (with all its internal contents).
    `java.util.SortedMap<T,java.lang.Integer>` | `createNeutral()`
    `T` | `getAggregate(java.util.SortedMap<T,java.lang.Integer> result)`
    `static <T extends java.lang.Comparable<T>> ExtremumOperator<T>` | `getMax()`
    `static <T extends java.lang.Comparable<T>> ExtremumOperator<T>` | `getMin()`
    `java.lang.String` | `getName()` A name or identifier of the operator.
    `java.lang.String` | `getShortDescription()` A textual description of the operator.
    `boolean` | `isNeutral(java.util.SortedMap<T,java.lang.Integer> result)`
    `java.util.SortedMap<T,java.lang.Integer>` | `update(java.util.SortedMap<T,java.lang.Integer> oldResult, T 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 org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.IMultisetAggregationOperator

      `combine, contains, prettyPrint`

- - ### Method Detail

    - #### getMin

          public static <T extends java.lang.Comparable<T>> ExtremumOperator<T> getMin()

    - #### getMax

          public static <T extends java.lang.Comparable<T>> ExtremumOperator<T> getMax()

    - #### getShortDescription

          public java.lang.String getShortDescription()

      Description copied from interface: `IMultisetAggregationOperator`
      A textual description of the operator.
      Specified by:
        `getShortDescription` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.Comparable<T>>`

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `IMultisetAggregationOperator`
      A name or identifier of the operator.
      Specified by:
        `getName` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.Comparable<T>>`

    - #### createNeutral

          public java.util.SortedMap<T,java.lang.Integer> createNeutral()

      Specified by:
        `createNeutral` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.Comparable<T>>`
      Returns:
        the neutral element, i.e. the interim result of aggregating an empty multiset.
      Since:
        2.0

    - #### isNeutral

          public boolean isNeutral(java.util.SortedMap<T,java.lang.Integer> result)

      Specified by:
        `isNeutral` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.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 java.util.SortedMap<T,java.lang.Integer> update(java.util.SortedMap<T,java.lang.Integer> oldResult,
                                                                 T updateValue,
                                                                 boolean isInsertion)

      Specified by:
        `update` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.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

          public T getAggregate(java.util.SortedMap<T,java.lang.Integer> result)

      Specified by:
        `getAggregate` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.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

          public T aggregateStream(java.util.stream.Stream<T> 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<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.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

          public java.util.SortedMap<T,java.lang.Integer> clone(java.util.SortedMap<T,java.lang.Integer> original)

      Description copied from interface: `IMultisetAggregationOperator`
      Clones the given accumulator (with all its internal contents).
      Specified by:
        `clone` in interface `IMultisetAggregationOperator<T extends java.lang.Comparable<T>,java.util.SortedMap<T extends java.lang.Comparable<T>,java.lang.Integer>,T extends java.lang.Comparable<T>>`
      Since:
        2.4