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 CommunicationGroup
protected final boolean
protected final Map
<Tuple, Accumulator> protected final IPosetComparator
protected final Map
<Tuple, Accumulator> Fields inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
aggregatorOuterIdentityIndexers, aggregatorOuterIndexer, columnMask, groupMask, NEUTRAL, operator, runtimeContext, sourceWidth
Fields inherited from class tools.refinery.interpreter.rete.single.SingleInputNode
mailbox, parent
Fields inherited from class tools.refinery.interpreter.rete.network.StandardNode
childMailboxes, children
Fields 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 TypeMethodDescriptionvoid
batchUpdate
(Collection<Map.Entry<Tuple, Integer>> updates, Timestamp timestamp) Updates the receiver in batch style with a collection of updates.void
clear()
protected Accumulator
getAccumulator
(Tuple key, Map<Tuple, Accumulator> memory) getAggregateResult
(Tuple group) getAggregateTuple
(Tuple group) protected Accumulator
getMainAccumulator
(Tuple key) protected Accumulator
protected Mailbox
Instantiates theMailbox
of this receiver.boolean
Returns true if this node actually runs in DRed mode (not necessarily).void
The method is called by theReteContainer
to re-derive tuples after the normal messages have been delivered and consumed.void
setCurrentGroup
(CommunicationGroup currentGroup) Sets the current group of the mailboxprotected boolean
storeIfNotNeutral
(Tuple key, Accumulator accumulator, Map<Tuple, Accumulator> memory) Returns true if the accumulator was stored, false otherwise.void
Updates the receiver with a newly found or lost partial matching.protected void
updateDefault
(Direction direction, Tuple update, Timestamp timestamp) protected void
updateWithDeleteAndRederive
(Direction direction, Tuple update, boolean monotone) void
updateWithPosetInfo
(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, tupleFromAggregateResult
Methods inherited from class tools.refinery.interpreter.rete.single.SingleInputNode
appendParent, assignTraceInfo, getMailbox, getParents, propagatePullInto, propagatePullIntoWithTimestamp, removeParent
Methods inherited from class tools.refinery.interpreter.rete.network.StandardNode
constructIndex, getChildMailboxes, getPulledContents, getReceivers, issueError, networkStructureChanged, propagateUpdate, removeChild
Methods inherited from class tools.refinery.interpreter.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 tools.refinery.interpreter.rete.network.Node
acceptPropagatedTraceInfo, assignTraceInfo, getCommunicationTracker, getContainer, getNodeId, getTag, getTraceInfos, setTag
Methods inherited from interface tools.refinery.interpreter.rete.network.Receiver
appendParent, getMailbox, getParents, removeParent
Methods 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:RederivableNode
Returns true if this node actually runs in DRed mode (not necessarily).- Specified by:
isInDRedMode
in interfaceRederivableNode
- Returns:
- true if the node is operating in DRed mode
-
instantiateMailbox
Description copied from class:SingleInputNode
Instantiates theMailbox
of this receiver. Subclasses may override this method to provide their own mailbox implementation.- Overrides:
instantiateMailbox
in classSingleInputNode
- Returns:
- the mailbox
-
getCoreMask
- Specified by:
getCoreMask
in interfacePosetAwareReceiver
-
getPosetMask
- Specified by:
getPosetMask
in interfacePosetAwareReceiver
-
getPosetComparator
- Specified by:
getPosetComparator
in interfacePosetAwareReceiver
-
rederiveOne
public void rederiveOne()Description copied from interface:RederivableNode
The method is called by theReteContainer
to 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:
rederiveOne
in interfaceRederivableNode
-
updateWithPosetInfo
Description copied from interface:PosetAwareReceiver
Updates the receiver with a newly found or lost partial matching also providing information whether the update is a monotone change or not.- Specified by:
updateWithPosetInfo
in interfacePosetAwareReceiver
- Parameters:
direction
- the direction of the updateupdate
- the update tuplemonotone
- true if the update is monotone, false otherwise
-
update
Description copied from interface:Receiver
Updates the receiver with a newly found or lost partial matching. -
updateDefault
- Since:
- 2.4
-
updateWithDeleteAndRederive
- Since:
- 2.4
-
batchUpdate
Description copied from interface:Receiver
Updates 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:
batchUpdate
in 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:
getAggregateTuple
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getAggregateResult
- Specified by:
getAggregateResult
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getAggregateResultTimeline
- Specified by:
getAggregateResultTimeline
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getAggregateTupleTimeline
- Specified by:
getAggregateTupleTimeline
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getMainAccumulator
- Since:
- 1.6
-
getRederivableAccumulator
- Since:
- 1.6
-
getAccumulator
- Since:
- 1.6
-
getCurrentGroup
- Specified by:
getCurrentGroup
in interfaceIGroupable
- Returns:
- the current group of the mailbox
-
setCurrentGroup
Description copied from interface:IGroupable
Sets the current group of the mailbox- Specified by:
setCurrentGroup
in interfaceIGroupable
-