Class OutputCachingEvaluatorNode
- 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.eval.AbstractEvaluatorNode
-
- org.eclipse.viatra.query.runtime.rete.eval.OutputCachingEvaluatorNode
-
- All Implemented Interfaces:
Clearable
,IEvaluatorNode
,org.eclipse.viatra.query.runtime.rete.network.communication.timely.ResumableNode
,IGroupable
,NetworkStructureChangeSensitiveNode
,Node
,Receiver
,Supplier
,Tunnel
public class OutputCachingEvaluatorNode extends AbstractEvaluatorNode implements Clearable, org.eclipse.viatra.query.runtime.rete.network.communication.timely.ResumableNode
An evaluator node that caches the evaluation result. This node is also capable of caching the timestamps associated with the result tuples if it is used in recursive differential dataflow evaluation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
OutputCachingEvaluatorNode.NetworkStructureChangeSensitiveLogic
-
Field Summary
Fields Modifier and Type Field Description protected CommunicationGroup
group
protected OutputCachingEvaluatorNode.NetworkStructureChangeSensitiveLogic
logic
protected TimelyMemory<Timestamp>
memory
Maps input tuples to timestamps.protected java.util.Map<Tuple,java.lang.Iterable<Tuple>>
outputCache
-
Fields inherited from class org.eclipse.viatra.query.runtime.rete.eval.AbstractEvaluatorNode
core
-
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 OutputCachingEvaluatorNode(ReteContainer reteContainer, EvaluatorCore core)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all partial matchings stored in memoryprotected OutputCachingEvaluatorNode.NetworkStructureChangeSensitiveLogic
createLogic()
CommunicationGroup
getCurrentGroup()
Timestamp
getResumableTimestamp()
Returns the smallest timestamp where lazy folding shall be resumed, or null if there is no more folding to do in this resumable.void
networkStructureChanged()
At the time of the invocation, the dependency graph has already been updated.void
pullInto(java.util.Collection<Tuple> collector, boolean flush)
Pulls the contents of this object in this particular moment into a target collection.void
pullIntoWithTimeline(java.util.Map<Tuple,Timeline<Timestamp>> collector, boolean flush)
void
resumeAt(Timestamp timestamp)
When called, the folding of the state shall be resumed at the given timestamp.void
setCurrentGroup(CommunicationGroup group)
Sets the current group of the mailboxvoid
update(Direction direction, Tuple input, Timestamp timestamp)
Updates the receiver with a newly found or lost partial matching.-
Methods inherited from class org.eclipse.viatra.query.runtime.rete.eval.AbstractEvaluatorNode
getReteContainer, prettyPrintTraceInfoPatternList, propagateIterableUpdate
-
Methods inherited from class org.eclipse.viatra.query.runtime.rete.single.SingleInputNode
appendParent, assignTraceInfo, getCommunicationTracker, getMailbox, getParents, instantiateMailbox, propagatePullInto, propagatePullIntoWithTimestamp, removeParent
-
Methods inherited from class org.eclipse.viatra.query.runtime.rete.network.StandardNode
appendChild, constructIndex, getChildMailboxes, getPulledContents, getReceivers, issueError, 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
batchUpdate
-
Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Supplier
appendChild, constructIndex, getPulledContents, getPulledContents, getReceivers, removeChild
-
-
-
-
Field Detail
-
logic
protected OutputCachingEvaluatorNode.NetworkStructureChangeSensitiveLogic logic
- Since:
- 2.3
-
memory
protected TimelyMemory<Timestamp> memory
Maps input tuples to timestamps. It is wrong to map evaluation result to timestamps because the different input tuples may yield the same evaluation result. This field is null as long as this node is in a non-recursive group.- Since:
- 2.4
-
group
protected CommunicationGroup group
- Since:
- 2.4
-
-
Constructor Detail
-
OutputCachingEvaluatorNode
public OutputCachingEvaluatorNode(ReteContainer reteContainer, EvaluatorCore core)
- Since:
- 1.5
-
-
Method Detail
-
getCurrentGroup
public CommunicationGroup getCurrentGroup()
- Specified by:
getCurrentGroup
in interfaceIGroupable
- Returns:
- the current group of the mailbox
-
setCurrentGroup
public void setCurrentGroup(CommunicationGroup group)
Description copied from interface:IGroupable
Sets the current group of the mailbox- Specified by:
setCurrentGroup
in interfaceIGroupable
-
networkStructureChanged
public void networkStructureChanged()
Description copied from interface:NetworkStructureChangeSensitiveNode
At the time of the invocation, the dependency graph has already been updated.- Specified by:
networkStructureChanged
in interfaceNetworkStructureChangeSensitiveNode
- Overrides:
networkStructureChanged
in classStandardNode
-
clear
public void clear()
Description copied from interface:Clearable
Clear all partial matchings stored in memory
-
createLogic
protected OutputCachingEvaluatorNode.NetworkStructureChangeSensitiveLogic createLogic()
- Since:
- 2.3
-
pullInto
public void pullInto(java.util.Collection<Tuple> collector, boolean flush)
Description copied from interface:Supplier
Pulls the contents of this object in this particular moment into a target collection.
-
pullIntoWithTimeline
public void pullIntoWithTimeline(java.util.Map<Tuple,Timeline<Timestamp>> collector, boolean flush)
- Specified by:
pullIntoWithTimeline
in interfaceSupplier
-
update
public void update(Direction direction, Tuple input, Timestamp timestamp)
Description copied from interface:Receiver
Updates the receiver with a newly found or lost partial matching.
-
getResumableTimestamp
public Timestamp getResumableTimestamp()
Description copied from interface:org.eclipse.viatra.query.runtime.rete.network.communication.timely.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 interfaceorg.eclipse.viatra.query.runtime.rete.network.communication.timely.ResumableNode
- Since:
- 2.4
-
resumeAt
public void resumeAt(Timestamp timestamp)
Description copied from interface:org.eclipse.viatra.query.runtime.rete.network.communication.timely.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 interfaceorg.eclipse.viatra.query.runtime.rete.network.communication.timely.ResumableNode
- Since:
- 2.4
-
-