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

## Class IntegerAverageOperator

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.aggregators.IntegerAverageOperator

- All Implemented Interfaces:
    `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`

      public class IntegerAverageOperator
      extends java.lang.Object
      implements IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>

  Since:
    2.0

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static IntegerAverageOperator` | `INSTANCE` |

  - ### Method Summary

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

- - ### Field Detail

    - #### INSTANCE

          public static final IntegerAverageOperator INSTANCE

  - ### Method Detail

    - #### getShortDescription

          public java.lang.String getShortDescription()

      Description copied from interface: `IMultisetAggregationOperator`
      A textual description of the operator.
      Specified by:
        `getShortDescription` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `IMultisetAggregationOperator`
      A name or identifier of the operator.
      Specified by:
        `getName` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`

    - #### createNeutral

          public org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> createNeutral()

      Specified by:
        `createNeutral` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`
      Returns:
        the neutral element, i.e. the interim result of aggregating an empty multiset.

    - #### isNeutral

          public boolean isNeutral​(org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> result)

      Specified by:
        `isNeutral` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.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 org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> update​(org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> oldResult,
                                                                                                                    java.lang.Integer updateValue,
                                                                                                                    boolean isInsertion)

      Specified by:
        `update` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.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 java.lang.Double getAggregate​(org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> result)

      Specified by:
        `getAggregate` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.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 java.lang.Double aggregateStream​(java.util.stream.Stream<java.lang.Integer> 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<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`
      Returns:
        the aggregate result, or null if no result can be calculated (e.g. because of an empty stream)

    - #### clone

          public org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> clone​(org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer> original)

      Description copied from interface: `IMultisetAggregationOperator`
      Clones the given accumulator (with all its internal contents).
      Specified by:
        `clone` in interface `IMultisetAggregationOperator<java.lang.Integer,​org.eclipse.viatra.query.runtime.matchers.aggregators.AverageAccumulator<java.lang.Integer>,​java.lang.Double>`
      Since:
        2.4