Class ColumnAggregatorNode<Domain,Accumulator,AggregateResult>
java.lang.Object
tools.refinery.interpreter.rete.network.BaseNode
tools.refinery.interpreter.rete.network.StandardNode
tools.refinery.interpreter.rete.single.SingleInputNode
tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
tools.refinery.interpreter.rete.aggregation.ColumnAggregatorNode<Domain,Accumulator,AggregateResult>
- All Implemented Interfaces:
Clearable,IAggregatorNode,IGroupable,NetworkStructureChangeSensitiveNode,Node,PosetAwareReceiver,Receiver,RederivableNode,Supplier,Tunnel
public class ColumnAggregatorNode<Domain,Accumulator,AggregateResult>
extends AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
implements RederivableNode, PosetAwareReceiver
Timeless implementation of the column aggregator node.
The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the
node with an IPosetComparator to identify monotone changes; thus, ensuring that a fix-point can be reached
during the evaluation.
- Since:
- 1.4
-
Nested Class Summary
Nested classes/interfaces inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer, AbstractColumnAggregatorNode.AggregatorOuterIndexer, AbstractColumnAggregatorNode.NetworkStructureChangeSensitiveLogic -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CommunicationGroupprotected final booleanprotected final Map<Tuple, Accumulator> protected final IPosetComparatorprotected final Map<Tuple, Accumulator> Fields inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
aggregatorOuterIdentityIndexers, aggregatorOuterIndexer, columnMask, groupMask, NEUTRAL, operator, runtimeContext, sourceWidthFields inherited from class tools.refinery.interpreter.rete.single.SingleInputNode
mailbox, parentFields inherited from class tools.refinery.interpreter.rete.network.StandardNode
childMailboxes, childrenFields inherited from class tools.refinery.interpreter.rete.network.BaseNode
nodeId, reteContainer, tag, traceInfos -
Constructor Summary
ConstructorsConstructorDescriptionColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, boolean deleteRederiveEvaluation, TupleMask groupMask, TupleMask columnMask, IPosetComparator posetComparator) Creates a new column aggregator node.ColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, TupleMask groupMask, int aggregatedColumn) Creates a new column aggregator node. -
Method Summary
Modifier and TypeMethodDescriptionvoidbatchUpdate(Collection<Map.Entry<Tuple, Integer>> updates, Timestamp timestamp) Updates the receiver in batch style with a collection of updates.voidclear()protected AccumulatorgetAccumulator(Tuple key, Map<Tuple, Accumulator> memory) getAggregateResult(Tuple group) getAggregateTuple(Tuple group) protected AccumulatorgetMainAccumulator(Tuple key) protected Accumulatorprotected MailboxInstantiates theMailboxof this receiver.booleanReturns true if this node actually runs in DRed mode (not necessarily).voidThe method is called by theReteContainerto re-derive tuples after the normal messages have been delivered and consumed.voidsetCurrentGroup(CommunicationGroup currentGroup) Sets the current group of the mailboxprotected booleanstoreIfNotNeutral(Tuple key, Accumulator accumulator, Map<Tuple, Accumulator> memory) Returns true if the accumulator was stored, false otherwise.voidUpdates the receiver with a newly found or lost partial matching.protected voidupdateDefault(Direction direction, Tuple update, Timestamp timestamp) protected voidupdateWithDeleteAndRederive(Direction direction, Tuple update, boolean monotone) voidupdateWithPosetInfo(Direction direction, Tuple update, boolean monotone) Updates the receiver with a newly found or lost partial matching also providing information whether the update is a monotone change or not.Methods inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
appendChild, getAggregatorOuterIdentityIndexer, getAggregatorOuterIndexer, getCommunicationTracker, propagate, propagateAggregateResultUpdate, pullInto, pullIntoWithTimeline, tupleFromAggregateResultMethods inherited from class tools.refinery.interpreter.rete.single.SingleInputNode
appendParent, assignTraceInfo, getMailbox, getParents, propagatePullInto, propagatePullIntoWithTimestamp, removeParentMethods inherited from class tools.refinery.interpreter.rete.network.StandardNode
constructIndex, getChildMailboxes, getPulledContents, getReceivers, issueError, networkStructureChanged, propagateUpdate, removeChildMethods inherited from class tools.refinery.interpreter.rete.network.BaseNode
acceptPropagatedTraceInfo, getContainer, getNodeId, getTag, getTraceInfoPatternsEnumerated, getTraceInfos, setTag, toString, toStringCoreMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface tools.refinery.interpreter.rete.network.Node
acceptPropagatedTraceInfo, assignTraceInfo, getCommunicationTracker, getContainer, getNodeId, getTag, getTraceInfos, setTagMethods inherited from interface tools.refinery.interpreter.rete.network.Receiver
appendParent, getMailbox, getParents, removeParentMethods inherited from interface tools.refinery.interpreter.rete.network.Supplier
constructIndex, getPulledContents, getPulledContents, getReceivers, removeChild
-
Field Details
-
posetComparator
- Since:
- 1.6
-
deleteRederiveEvaluation
protected final boolean deleteRederiveEvaluation- Since:
- 1.6
-
memory
- Since:
- 1.6
-
rederivableMemory
- Since:
- 1.6
-
currentGroup
- Since:
- 1.7
-
-
Constructor Details
-
ColumnAggregatorNode
public ColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, boolean deleteRederiveEvaluation, TupleMask groupMask, TupleMask columnMask, IPosetComparator posetComparator) Creates a new column aggregator node.- Parameters:
reteContainer- the RETE container of the nodeoperator- the aggregation operatordeleteRederiveEvaluation- true if the node should run in DRED mode, false otherwisegroupMask- the mask that masks a tuple to obtain the key that we are grouping-bycolumnMask- the mask that masks a tuple to obtain the tuple element(s) that we are aggregating overposetComparator- the poset comparator for the column, if known, otherwise it can be null- Since:
- 1.6
-
ColumnAggregatorNode
public ColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, TupleMask groupMask, int aggregatedColumn) Creates a new column aggregator node.- Parameters:
reteContainer- the RETE container of the nodeoperator- the aggregation operatorgroupMask- the mask that masks a tuple to obtain the key that we are grouping-byaggregatedColumn- the index of the column that the aggregator node is aggregating over
-
-
Method Details
-
isInDRedMode
public boolean isInDRedMode()Description copied from interface:RederivableNodeReturns true if this node actually runs in DRed mode (not necessarily).- Specified by:
isInDRedModein interfaceRederivableNode- Returns:
- true if the node is operating in DRed mode
-
instantiateMailbox
Description copied from class:SingleInputNodeInstantiates theMailboxof this receiver. Subclasses may override this method to provide their own mailbox implementation.- Overrides:
instantiateMailboxin classSingleInputNode- Returns:
- the mailbox
-
getCoreMask
- Specified by:
getCoreMaskin interfacePosetAwareReceiver
-
getPosetMask
- Specified by:
getPosetMaskin interfacePosetAwareReceiver
-
getPosetComparator
- Specified by:
getPosetComparatorin interfacePosetAwareReceiver
-
rederiveOne
public void rederiveOne()Description copied from interface:RederivableNodeThe method is called by theReteContainerto re-derive tuples after the normal messages have been delivered and consumed. The re-derivation process may trigger the creation and delivery of further messages and further re-derivation rounds.- Specified by:
rederiveOnein interfaceRederivableNode
-
updateWithPosetInfo
Description copied from interface:PosetAwareReceiverUpdates the receiver with a newly found or lost partial matching also providing information whether the update is a monotone change or not.- Specified by:
updateWithPosetInfoin interfacePosetAwareReceiver- Parameters:
direction- the direction of the updateupdate- the update tuplemonotone- true if the update is monotone, false otherwise
-
update
Description copied from interface:ReceiverUpdates the receiver with a newly found or lost partial matching. -
updateDefault
- Since:
- 2.4
-
updateWithDeleteAndRederive
- Since:
- 2.4
-
batchUpdate
Description copied from interface:ReceiverUpdates the receiver in batch style with a collection of updates. The input collection consists of pairs in the form (t, c) where t is an update tuple and c is the count. The count can also be negative, and it specifies how many times the tuple t gets deleted or inserted. The default implementation of this method simply callsReceiver.update(Direction, Tuple, Timestamp)individually for all updates.- Specified by:
batchUpdatein interfaceReceiver
-
clear
public void clear() -
storeIfNotNeutral
protected boolean storeIfNotNeutral(Tuple key, Accumulator accumulator, Map<Tuple, Accumulator> memory) Returns true if the accumulator was stored, false otherwise.- Since:
- 1.6
-
getAggregateTuple
- Specified by:
getAggregateTuplein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getAggregateResult
- Specified by:
getAggregateResultin classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getAggregateResultTimeline
- Specified by:
getAggregateResultTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getAggregateTupleTimeline
- Specified by:
getAggregateTupleTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getMainAccumulator
- Since:
- 1.6
-
getRederivableAccumulator
- Since:
- 1.6
-
getAccumulator
- Since:
- 1.6
-
getCurrentGroup
- Specified by:
getCurrentGroupin interfaceIGroupable- Returns:
- the current group of the mailbox
-
setCurrentGroup
Description copied from interface:IGroupableSets the current group of the mailbox- Specified by:
setCurrentGroupin interfaceIGroupable
-