org.eclipse.viatra.query.runtime.rete.aggregation

## Class AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>

- java.lang.Object
- - org.eclipse.viatra.query.runtime.rete.network.BaseNode
  - - org.eclipse.viatra.query.runtime.rete.network.StandardNode
    - - org.eclipse.viatra.query.runtime.rete.single.SingleInputNode
      - - org.eclipse.viatra.query.runtime.rete.aggregation.AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>

- All Implemented Interfaces:
    Clearable, IAggregatorNode, NetworkStructureChangeSensitiveNode, Node, Receiver, Supplier, Tunnel
  Direct Known Subclasses:
    ColumnAggregatorNode

      public abstract class AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
      extends SingleInputNode
      implements Clearable, IAggregatorNode

  Groups incoming tuples by the given mask, and aggregates values at a specific index in each group.

  Direct children are not supported, use via outer join indexers instead.

  There are both timeless and timely implementations.

  Since:
    2.2

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer` A special non-iterable index that checks a suspected aggregate value for a given signature.
    `protected class` | `AbstractColumnAggregatorNode.AggregatorOuterIndexer` A special non-iterable index that retrieves the aggregated, packed result (signature+aggregate) for the original signature.
    `protected static class` | `AbstractColumnAggregatorNode.NetworkStructureChangeSensitiveLogic`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer[]` | `aggregatorOuterIdentityIndexers`
    `protected AbstractColumnAggregatorNode.AggregatorOuterIndexer` | `aggregatorOuterIndexer`
    `protected TupleMask` | `columnMask`
    `protected TupleMask` | `groupMask`
    `protected AggregateResult` | `NEUTRAL`
    `protected IMultisetAggregationOperator<Domain,Accumulator,AggregateResult>` | `operator`
    `protected IQueryRuntimeContext` | `runtimeContext`
    `protected int` | `sourceWidth`

    - ### Fields inherited from class org.eclipse.viatra.query.runtime.rete.single.SingleInputNode

      `mailbox, parent`

    - ### Fields inherited from class org.eclipse.viatra.query.runtime.rete.network.StandardNode

      `childMailboxes, children`

    - ### Fields inherited from class org.eclipse.viatra.query.runtime.rete.network.BaseNode

      `nodeId, reteContainer, tag, traceInfos`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain,Accumulator,AggregateResult> operator, TupleMask groupMask, int aggregatedColumn)` Creates a new column aggregator node.
    `AbstractColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain,Accumulator,AggregateResult> operator, TupleMask groupMask, TupleMask columnMask)` Creates a new column aggregator node.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `appendChild(Receiver receiver)` appends a receiver that will continously receive insert and revoke updates from this supplier
    `abstract AggregateResult` | `getAggregateResult(Tuple key)`
    `abstract java.util.Map<AggregateResult,Timeline<Timestamp>>` | `getAggregateResultTimeline(Tuple key)`
    `abstract Tuple` | `getAggregateTuple(Tuple key)`
    `abstract java.util.Map<Tuple,Timeline<Timestamp>>` | `getAggregateTupleTimeline(Tuple key)`
    `Indexer` | `getAggregatorOuterIdentityIndexer(int resultPositionInSignature)`
    `Indexer` | `getAggregatorOuterIndexer()`
    `CommunicationTracker` | `getCommunicationTracker()`
    `void` | `propagate(Direction direction, Tuple group, AggregateResult value, Timestamp timestamp)`
    `void` | `propagateAggregateResultUpdate(Tuple group, AggregateResult oldValue, AggregateResult newValue, Timestamp timestamp)`
    `void` | `pullInto(java.util.Collection<Tuple> collector, boolean flush)` Pulls the contents of this object in this particular moment into a target collection.
    `void` | `pullIntoWithTimeline(java.util.Map<Tuple,Timeline<Timestamp>> collector, boolean flush)`
    `protected Tuple` | `tupleFromAggregateResult(Tuple groupTuple, AggregateResult aggregateResult)`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.rete.single.SingleInputNode

      `appendParent, assignTraceInfo, getMailbox, getParents, instantiateMailbox, propagatePullInto, propagatePullIntoWithTimestamp, removeParent`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.rete.network.StandardNode

      `constructIndex, getChildMailboxes, getPulledContents, getReceivers, issueError, networkStructureChanged, propagateUpdate, removeChild`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.rete.network.BaseNode

      `acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfoPatternsEnumerated, getTraceInfos, setTag, toString, toStringCore`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.util.Clearable

      `clear`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Supplier

      `constructIndex, getPulledContents, getPulledContents, getReceivers, removeChild`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Receiver

      `update`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Node

      `acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfos, setTag`

- - ### Field Detail

    - #### operator

          protected final IMultisetAggregationOperator<Domain,Accumulator,AggregateResult> operator

      Since:
        1.6

    - #### groupMask

          protected final TupleMask groupMask

      Since:
        1.6

    - #### columnMask

          protected final TupleMask columnMask

      Since:
        1.6

    - #### sourceWidth

          protected final int sourceWidth

      Since:
        1.6

    - #### runtimeContext

          protected final IQueryRuntimeContext runtimeContext

      Since:
        1.6

    - #### NEUTRAL

          protected final AggregateResult NEUTRAL

    - #### aggregatorOuterIndexer

          protected AbstractColumnAggregatorNode.AggregatorOuterIndexer aggregatorOuterIndexer

    - #### aggregatorOuterIdentityIndexers

          protected AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer[] aggregatorOuterIdentityIndexers

  - ### Constructor Detail

    - #### AbstractColumnAggregatorNode

          public AbstractColumnAggregatorNode(ReteContainer reteContainer,
                                              IMultisetAggregationOperator<Domain,Accumulator,AggregateResult> operator,
                                              TupleMask groupMask,
                                              TupleMask columnMask)

      Creates a new column aggregator node.
      Parameters:
        `reteContainer` - the RETE container of the node
        `operator` - the aggregation operator
        `deleteRederiveEvaluation` - true if the node should run in DRED mode, false otherwise
        `groupMask` - the mask that masks a tuple to obtain the key that we are grouping-by
        `columnMask` - the mask that masks a tuple to obtain the tuple element(s) that we are aggregating over
        `posetComparator` - the poset comparator for the column, if known, otherwise it can be null
      Since:
        1.6

    - #### AbstractColumnAggregatorNode

          public AbstractColumnAggregatorNode(ReteContainer reteContainer,
                                              IMultisetAggregationOperator<Domain,Accumulator,AggregateResult> operator,
                                              TupleMask groupMask,
                                              int aggregatedColumn)

      Creates a new column aggregator node.
      Parameters:
        `reteContainer` - the RETE container of the node
        `operator` - the aggregation operator
        `groupMask` - the mask that masks a tuple to obtain the key that we are grouping-by
        `aggregatedColumn` - the index of the column that the aggregator node is aggregating over

  - ### Method Detail

    - #### getCommunicationTracker

          public CommunicationTracker getCommunicationTracker()

      Specified by:
        `getCommunicationTracker` in interface `Node`
      Overrides:
        `getCommunicationTracker` in class `SingleInputNode`

    - #### pullInto

          public void pullInto(java.util.Collection<Tuple> collector,
                               boolean flush)

      Description copied from interface: `Supplier`
      Pulls the contents of this object in this particular moment into a target collection.
      Specified by:
        `pullInto` in interface `Supplier`
        `flush` - if true, flushing of messages is allowed during the pull, otherwise flushing is not allowed

    - #### pullIntoWithTimeline

          public void pullIntoWithTimeline(java.util.Map<Tuple,Timeline<Timestamp>> collector,
                                           boolean flush)

      Specified by:
        `pullIntoWithTimeline` in interface `Supplier`

    - #### appendChild

          public void appendChild(Receiver receiver)

      Description copied from interface: `Supplier`
      appends a receiver that will continously receive insert and revoke updates from this supplier
      Specified by:
        `appendChild` in interface `Supplier`
      Overrides:
        `appendChild` in class `StandardNode`

    - #### getAggregatorOuterIndexer

          public Indexer getAggregatorOuterIndexer()

      Specified by:
        `getAggregatorOuterIndexer` in interface `IAggregatorNode`

    - #### getAggregatorOuterIdentityIndexer

          public Indexer getAggregatorOuterIdentityIndexer(int resultPositionInSignature)

      Specified by:
        `getAggregatorOuterIdentityIndexer` in interface `IAggregatorNode`

    - #### propagateAggregateResultUpdate

          public void propagateAggregateResultUpdate(Tuple group,
                                                     AggregateResult oldValue,
                                                     AggregateResult newValue,
                                                     Timestamp timestamp)

      Since:
        2.4

    - #### propagate

          public void propagate(Direction direction,
                                Tuple group,
                                AggregateResult value,
                                Timestamp timestamp)

      Since:
        2.4

    - #### getAggregateTuple

          public abstract Tuple getAggregateTuple(Tuple key)

    - #### getAggregateTupleTimeline

          public abstract java.util.Map<Tuple,Timeline<Timestamp>> getAggregateTupleTimeline(Tuple key)

      Since:
        2.4

    - #### getAggregateResult

          public abstract AggregateResult getAggregateResult(Tuple key)

    - #### getAggregateResultTimeline

          public abstract java.util.Map<AggregateResult,Timeline<Timestamp>> getAggregateResultTimeline(Tuple key)

      Since:
        2.4

    - #### tupleFromAggregateResult

          protected Tuple tupleFromAggregateResult(Tuple groupTuple,
                                                   AggregateResult aggregateResult)