Class IndexerBasedAggregatorNode

  • All Implemented Interfaces:
    IAggregatorNode, NetworkStructureChangeSensitiveNode, Node, Supplier
    Direct Known Subclasses:
    CountNode

    public abstract class IndexerBasedAggregatorNode
    extends StandardNode
    implements IAggregatorNode
    A special node depending on a projection indexer to aggregate tuple groups with the same projection. Only propagates the aggregates of non-empty groups. Use the outer indexers to circumvent.

    This node cannot be used in recursive differential dataflow evaluation.

    Since:
    1.4
    • Constructor Detail

      • IndexerBasedAggregatorNode

        public IndexerBasedAggregatorNode​(ReteContainer reteContainer)
        MUST call initializeWith() afterwards!
    • Method Detail

      • initializeWith

        public void initializeWith​(ProjectionIndexer projection)
        Parameters:
        projection - the projection indexer whose tuple groups should be aggregated
      • aggregateGroup

        public abstract java.lang.Object aggregateGroup​(Tuple signature,
                                                        java.util.Collection<Tuple> group)
        Aggregates (reduces) a group of tuples. The group can be null.
      • aggregateGroupAfterUpdate

        public java.lang.Object aggregateGroupAfterUpdate​(Tuple signature,
                                                          java.util.Collection<Tuple> currentGroup,
                                                          java.lang.Object oldAggregate,
                                                          Direction direction,
                                                          Tuple updateElement,
                                                          boolean change)
        Aggregates (reduces) a group of tuples, having access to the previous aggregated value (before the update) and the update definition. Defaults to aggregateGroup(). Override to increase performance.
        Since:
        2.4
      • aggregateAndPack

        protected Tuple aggregateAndPack​(Tuple signature,
                                         java.util.Collection<Tuple> group)
      • 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
      • packResult

        protected Tuple packResult​(Tuple signature,
                                   java.lang.Object result)
      • aggregateUpdate

        protected void aggregateUpdate​(Direction direction,
                                       Tuple updateElement,
                                       Tuple signature,
                                       boolean change)
        Since:
        2.4