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

## Class LongSumOperator

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator<java.lang.Long,java.lang.Long>
  - - org.eclipse.viatra.query.runtime.matchers.aggregators.LongSumOperator

- All Implemented Interfaces:
    IMultisetAggregationOperator<java.lang.Long,java.lang.Long,java.lang.Long>

      public class LongSumOperator
      extends AbstractMemorylessAggregationOperator<java.lang.Long,java.lang.Long>

  Incrementally computes the sum of java.lang.Long values
  Since:
    1.4

- - ### Field Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Long` | `aggregateStream(java.util.stream.Stream<java.lang.Long> stream)` Calculates the aggregate results from a given stream of values; all values are considered as inserted
    `java.lang.Long` | `createNeutral()`
    `java.lang.String` | `getName()` A name or identifier of the operator.
    `java.lang.String` | `getShortDescription()` A textual description of the operator.
    `boolean` | `isNeutral(java.lang.Long result)`
    `java.lang.Long` | `update(java.lang.Long oldResult, java.lang.Long updateValue, boolean isInsertion)`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.matchers.psystem.aggregations.AbstractMemorylessAggregationOperator

      `clone, getAggregate`

    - ### 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 LongSumOperator INSTANCE

  - ### Method Detail

    - #### getShortDescription

          public java.lang.String getShortDescription()

      Description copied from interface: `IMultisetAggregationOperator`
      A textual description of the operator.

    - #### getName

          public java.lang.String getName()

      Description copied from interface: `IMultisetAggregationOperator`
      A name or identifier of the operator.

    - #### createNeutral

          public java.lang.Long createNeutral()

      Returns:
        the neutral element, i.e. the interim result of aggregating an empty multiset.

    - #### isNeutral

          public boolean isNeutral(java.lang.Long result)

      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 java.lang.Long update(java.lang.Long oldResult,
                                       java.lang.Long updateValue,
                                       boolean isInsertion)

      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)

    - #### aggregateStream

          public java.lang.Long aggregateStream(java.util.stream.Stream<java.lang.Long> stream)

      Description copied from interface: `IMultisetAggregationOperator`
      Calculates the aggregate results from a given stream of values; all values are considered as inserted
      Returns:
        the aggregate result, or null if no result can be calculated (e.g. because of an empty stream)
      Since:
        2.0