Class ColumnAggregatorNode<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>
-
- org.eclipse.viatra.query.runtime.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
IPosetComparatorto 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 org.eclipse.viatra.query.runtime.rete.aggregation.AbstractColumnAggregatorNode
AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer, AbstractColumnAggregatorNode.AggregatorOuterIndexer, AbstractColumnAggregatorNode.NetworkStructureChangeSensitiveLogic
-
-
Field Summary
Fields Modifier and Type Field Description protected CommunicationGroupcurrentGroupprotected booleandeleteRederiveEvaluationprotected java.util.Map<Tuple,Accumulator>memoryprotected IPosetComparatorposetComparatorprotected java.util.Map<Tuple,Accumulator>rederivableMemory-
Fields inherited from class org.eclipse.viatra.query.runtime.rete.aggregation.AbstractColumnAggregatorNode
aggregatorOuterIdentityIndexers, aggregatorOuterIndexer, columnMask, groupMask, NEUTRAL, operator, runtimeContext, 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 Description ColumnAggregatorNode(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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Clear all partial matchings stored in memoryprotected AccumulatorgetAccumulator(Tuple key, java.util.Map<Tuple,Accumulator> memory)AggregateResultgetAggregateResult(Tuple group)java.util.Map<AggregateResult,Timeline<Timestamp>>getAggregateResultTimeline(Tuple key)TuplegetAggregateTuple(Tuple group)java.util.Map<Tuple,Timeline<Timestamp>>getAggregateTupleTimeline(Tuple key)TupleMaskgetCoreMask()CommunicationGroupgetCurrentGroup()protected AccumulatorgetMainAccumulator(Tuple key)IPosetComparatorgetPosetComparator()TupleMaskgetPosetMask()protected AccumulatorgetRederivableAccumulator(Tuple key)protected MailboxinstantiateMailbox()Instantiates theMailboxof this receiver.booleanisInDRedMode()Returns true if this node actually runs in DRed mode (not necessarily).voidrederiveOne()The 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, java.util.Map<Tuple,Accumulator> memory)Returns true if the accumulator was stored, false otherwise.voidupdate(Direction direction, Tuple update, Timestamp timestamp)Updates 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 org.eclipse.viatra.query.runtime.rete.aggregation.AbstractColumnAggregatorNode
appendChild, getAggregatorOuterIdentityIndexer, getAggregatorOuterIndexer, getCommunicationTracker, propagate, propagateAggregateResultUpdate, pullInto, pullIntoWithTimeline, tupleFromAggregateResult
-
Methods inherited from class org.eclipse.viatra.query.runtime.rete.single.SingleInputNode
appendParent, assignTraceInfo, getMailbox, getParents, 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.rete.network.Node
acceptPropagatedTraceInfo, assignTraceInfo, getCommunicationTracker, getContainer, getNodeId, getTag, getTraceInfos, setTag
-
Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Receiver
appendParent, batchUpdate, getMailbox, getParents, removeParent
-
Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Supplier
constructIndex, getPulledContents, getPulledContents, getReceivers, removeChild
-
-
-
-
Field Detail
-
posetComparator
protected final IPosetComparator posetComparator
- Since:
- 1.6
-
deleteRederiveEvaluation
protected final boolean deleteRederiveEvaluation
- Since:
- 1.6
-
memory
protected final java.util.Map<Tuple,Accumulator> memory
- Since:
- 1.6
-
rederivableMemory
protected final java.util.Map<Tuple,Accumulator> rederivableMemory
- Since:
- 1.6
-
currentGroup
protected CommunicationGroup currentGroup
- Since:
- 1.7
-
-
Constructor Detail
-
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 Detail
-
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
protected Mailbox 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
public TupleMask getCoreMask()
- Specified by:
getCoreMaskin interfacePosetAwareReceiver
-
getPosetMask
public TupleMask getPosetMask()
- Specified by:
getPosetMaskin interfacePosetAwareReceiver
-
getPosetComparator
public IPosetComparator 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
public void updateWithPosetInfo(Direction direction, Tuple update, boolean monotone)
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
public void update(Direction direction, Tuple update, Timestamp timestamp)
Description copied from interface:ReceiverUpdates the receiver with a newly found or lost partial matching.
-
updateDefault
protected void updateDefault(Direction direction, Tuple update, Timestamp timestamp)
- Since:
- 2.4
-
updateWithDeleteAndRederive
protected void updateWithDeleteAndRederive(Direction direction, Tuple update, boolean monotone)
- Since:
- 2.4
-
clear
public void clear()
Description copied from interface:ClearableClear all partial matchings stored in memory
-
storeIfNotNeutral
protected boolean storeIfNotNeutral(Tuple key, Accumulator accumulator, java.util.Map<Tuple,Accumulator> memory)
Returns true if the accumulator was stored, false otherwise.- Since:
- 1.6
-
getAggregateTuple
public Tuple getAggregateTuple(Tuple group)
- Specified by:
getAggregateTuplein classAbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
-
getAggregateResult
public AggregateResult getAggregateResult(Tuple group)
- Specified by:
getAggregateResultin classAbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
-
getAggregateResultTimeline
public java.util.Map<AggregateResult,Timeline<Timestamp>> getAggregateResultTimeline(Tuple key)
- Specified by:
getAggregateResultTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
-
getAggregateTupleTimeline
public java.util.Map<Tuple,Timeline<Timestamp>> getAggregateTupleTimeline(Tuple key)
- Specified by:
getAggregateTupleTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
-
getMainAccumulator
protected Accumulator getMainAccumulator(Tuple key)
- Since:
- 1.6
-
getRederivableAccumulator
protected Accumulator getRederivableAccumulator(Tuple key)
- Since:
- 1.6
-
getAccumulator
protected Accumulator getAccumulator(Tuple key, java.util.Map<Tuple,Accumulator> memory)
- Since:
- 1.6
-
getCurrentGroup
public CommunicationGroup getCurrentGroup()
- Specified by:
getCurrentGroupin interfaceIGroupable- Returns:
- the current group of the mailbox
-
setCurrentGroup
public void setCurrentGroup(CommunicationGroup currentGroup)
Description copied from interface:IGroupableSets the current group of the mailbox- Specified by:
setCurrentGroupin interfaceIGroupable
-
-