Class FaithfulTimelyColumnAggregatorNode<Domain,Accumulator,AggregateResult,CumulativeAggregate,FoldingState extends FaithfulTimelyColumnAggregatorNode.MergeableFoldingState<FoldingState>>
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.timely.FaithfulTimelyColumnAggregatorNode<Domain,Accumulator,AggregateResult,CumulativeAggregate,FoldingState>
- All Implemented Interfaces:
Clearable,IAggregatorNode,ResumableNode,IGroupable,NetworkStructureChangeSensitiveNode,Node,Receiver,Supplier,Tunnel
- Direct Known Subclasses:
FaithfulParallelTimelyColumnAggregatorNode,FaithfulSequentialTimelyColumnAggregatorNode
public abstract class FaithfulTimelyColumnAggregatorNode<Domain,Accumulator,AggregateResult,CumulativeAggregate,FoldingState extends FaithfulTimelyColumnAggregatorNode.MergeableFoldingState<FoldingState>>
extends AbstractColumnAggregatorNode<Domain,Accumulator,AggregateResult>
implements ResumableNode
Faithful timely implementation of the column aggregator node. Complete timelines (series of appearance invalid input: '&'
disappearance) are maintained for tuples.
Subclasses are responsible for implementing the aggregator architecture, and they must use the CumulativeAggregate type parameter for that.
This node supports recursive aggregation.
Subclasses are responsible for implementing the aggregator architecture, and they must use the CumulativeAggregate type parameter for that.
This node supports recursive aggregation.
- Since:
- 2.4
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static interfaceNested classes/interfaces inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
AbstractColumnAggregatorNode.AggregatorOuterIdentityIndexer, AbstractColumnAggregatorNode.AggregatorOuterIndexer, AbstractColumnAggregatorNode.NetworkStructureChangeSensitiveLogic -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Tuple, TreeMap<Timestamp, CumulativeAggregate>> protected CommunicationGroupprotected final TreeMap<Timestamp, Map<Tuple, FoldingState>> 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
ConstructorsConstructorDescriptionFaithfulTimelyColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, TupleMask groupMask, TupleMask columnMask) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddFoldingState(Tuple group, FoldingState state, Timestamp timestamp) Registers the given folding state for the specified timestamp and tuple.protected static <AggregateResult>
voidappendDiff(AggregateResult result, Signed<Timestamp> diff, Map<AggregateResult, Diff<Timestamp>> diffs) voidclear()protected abstract Map<AggregateResult, Diff<Timestamp>> doFoldingStep(Tuple group, FoldingState state, Timestamp timestamp) protected abstract voidgcAggregates(CumulativeAggregate aggregate, Tuple group, Timestamp timestamp) Garbage collects the counter of the given group and timestamp if the bag of aggregands is empty.protected abstract CumulativeAggregategetAggregate(Tuple group, Timestamp timestamp) On-demand initializes and returns the aggregate for the given group and timestamp.getAggregateResultTimeline(Tuple group) getAggregateTuple(Tuple group) getAggregateTupleTimeline(Tuple group) getInitialTimeline(AggregateResult result) Returns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.protected MailboxInstantiates theMailboxof this receiver.voidWhen called, the folding of the state shall be resumed at the given timestamp.voidsetCurrentGroup(CommunicationGroup currentGroup) Sets the current group of the mailboxprotected voidupdateTimeline(Tuple group, Map<AggregateResult, Diff<Timestamp>> diffs) Updates and garbage collects the timeline of the given tuple based on the given diffs.Methods inherited from class tools.refinery.interpreter.rete.aggregation.AbstractColumnAggregatorNode
appendChild, getAggregateResult, 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
batchUpdate, updateMethods inherited from interface tools.refinery.interpreter.rete.network.Supplier
constructIndex, getPulledContents, getPulledContents, getReceivers, removeChild
-
Field Details
-
aggregates
-
timelines
-
foldingState
protected final TreeMap<Timestamp,Map<Tuple, foldingStateFoldingState extends FaithfulTimelyColumnAggregatorNode.MergeableFoldingState<FoldingState>>> -
communicationGroup
-
NEUTRAL_INITIAL_TIMELINE
-
NON_NEUTRAL_INITIAL_TIMELINE
-
-
Constructor Details
-
FaithfulTimelyColumnAggregatorNode
public FaithfulTimelyColumnAggregatorNode(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, TupleMask groupMask, TupleMask columnMask)
-
-
Method Details
-
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
-
clear
public void clear() -
addFoldingState
Registers the given folding state for the specified timestamp and tuple. If there is already a state stored, the two states will be merged together. -
getResumableTimestamp
Description copied from interface:ResumableNodeReturns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.- Specified by:
getResumableTimestampin interfaceResumableNode
-
resumeAt
Description copied from interface:ResumableNodeWhen called, the folding of the state shall be resumed at the given timestamp. The resumable is expected to do a folding step at the given timestamp only. Afterwards, folding shall be interrupted, even if there is more folding to do towards higher timestamps.- Specified by:
resumeAtin interfaceResumableNode
-
doFoldingStep
protected abstract Map<AggregateResult,Diff<Timestamp>> doFoldingStep(Tuple group, FoldingState state, Timestamp timestamp) -
updateTimeline
Updates and garbage collects the timeline of the given tuple based on the given diffs. -
gcAggregates
protected abstract void gcAggregates(CumulativeAggregate aggregate, Tuple group, Timestamp timestamp) Garbage collects the counter of the given group and timestamp if the bag of aggregands is empty. -
getAggregate
On-demand initializes and returns the aggregate for the given group and timestamp. -
getInitialTimeline
-
appendDiff
-
getAggregateTuple
- Specified by:
getAggregateTuplein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getAggregateResultTimeline
- Specified by:
getAggregateResultTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
getAggregateTupleTimeline
- Specified by:
getAggregateTupleTimelinein classAbstractColumnAggregatorNode<Domain,Accumulator, AggregateResult>
-
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
-