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 interface
Nested 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 CommunicationGroup
protected final TreeMap
<Timestamp, Map<Tuple, FoldingState>> 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
ConstructorsConstructorDescriptionFaithfulTimelyColumnAggregatorNode
(ReteContainer reteContainer, IMultisetAggregationOperator<Domain, Accumulator, AggregateResult> operator, TupleMask groupMask, TupleMask columnMask) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addFoldingState
(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) void
clear()
protected abstract Map
<AggregateResult, Diff<Timestamp>> doFoldingStep
(Tuple group, FoldingState state, Timestamp timestamp) 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.protected abstract CumulativeAggregate
getAggregate
(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 Mailbox
Instantiates theMailbox
of this receiver.void
When called, the folding of the state shall be resumed at the given timestamp.void
setCurrentGroup
(CommunicationGroup currentGroup) Sets the current group of the mailboxprotected void
updateTimeline
(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, 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
batchUpdate, update
Methods 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:SingleInputNode
Instantiates theMailbox
of this receiver. Subclasses may override this method to provide their own mailbox implementation.- Overrides:
instantiateMailbox
in 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:ResumableNode
Returns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.- Specified by:
getResumableTimestamp
in interfaceResumableNode
-
resumeAt
Description copied from interface:ResumableNode
When 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:
resumeAt
in 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:
getAggregateTuple
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getAggregateResultTimeline
- Specified by:
getAggregateResultTimeline
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
getAggregateTupleTimeline
- Specified by:
getAggregateTupleTimeline
in classAbstractColumnAggregatorNode<Domain,
Accumulator, AggregateResult>
-
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
-