public abstract class CommunicationTracker
extends java.lang.Object
ReteContainer
. The tracker serves two purposes: ReteContainer
. The ordering is
governed by the strongly connected components in the dependency network and follows a topological sorting scheme;
those mailboxes will be emptied first whose owner nodes do not depend on other undelivered messages.Modifier and Type | Field and Description |
---|---|
protected Graph<Node> |
dependencyGraph
The dependency graph of the communications in the RETE network
|
protected java.util.Map<Node,CommunicationGroup> |
groupMap
Precomputed node -> communication group map
|
protected java.util.Queue<CommunicationGroup> |
groupQueue
Priority queue of active communication groups
|
protected int |
maxGroupId
The maximum group id assigned so far
|
protected int |
minGroupId
The minimum group id assigned so far
|
protected IncSCCAlg<Node> |
sccInformationProvider
Incremental SCC information about the dependency graph
|
Constructor and Description |
---|
CommunicationTracker() |
Modifier and Type | Method and Description |
---|---|
void |
activateUnenqueued(CommunicationGroup group) |
boolean |
areInSameGroup(Node left,
Node right)
Returns true if the given two
Node s are in the same CommunicationGroup . |
protected CommunicationGroup |
createAndStoreGroup(Node representative,
int index) |
protected abstract CommunicationGroup |
createGroup(Node representative,
int index) |
void |
deactivate(CommunicationGroup group) |
CommunicationGroup |
getAndRemoveFirstGroup() |
Graph<Node> |
getDependencyGraph() |
CommunicationGroup |
getGroup(Node node) |
boolean |
isEmpty() |
boolean |
isInRecursiveGroup(Node node)
Returns true if the given
Node is in a recursive CommunicationGroup , false otherwise. |
protected boolean |
isRecursionCutPoint(Node source,
Node target)
Returns true if the given source-target edge in the communication network acts as a recursion cut point.
|
protected abstract void |
postProcessGroup(CommunicationGroup group)
This hook allows concrete tracker implementations to perform tracker-specific post processing on groups.
|
protected abstract void |
postProcessNode(Node node)
This hook allows concrete tracker implementations to perform tracker-specific post processing on nodes (cf.
|
abstract IndexerListener |
proxifyIndexerListener(Node requester,
IndexerListener original)
Creates a proxy for the given
IndexerListener for the given requester Node . |
abstract Mailbox |
proxifyMailbox(Node requester,
Mailbox original)
|
protected abstract void |
reconstructQueueContents(java.util.Set<CommunicationGroup> oldActiveGroups)
This method is responsible for reconstructing the active queue contents after the network structure has changed.
|
void |
registerDependency(Node source,
Node target)
|
void |
unregisterDependency(Node source,
Node target)
Unregisters a dependency between source and target.
|
protected int minGroupId
protected int maxGroupId
protected final Graph<Node> dependencyGraph
protected final IncSCCAlg<Node> sccInformationProvider
protected final java.util.Map<Node,CommunicationGroup> groupMap
protected final java.util.Queue<CommunicationGroup> groupQueue
public CommunicationGroup getGroup(Node node)
protected abstract void reconstructQueueContents(java.util.Set<CommunicationGroup> oldActiveGroups)
CommunicationTracker
.public void activateUnenqueued(CommunicationGroup group)
public void deactivate(CommunicationGroup group)
public CommunicationGroup getAndRemoveFirstGroup()
public boolean isEmpty()
protected abstract CommunicationGroup createGroup(Node representative, int index)
protected CommunicationGroup createAndStoreGroup(Node representative, int index)
public void registerDependency(Node source, Node target)
Node
depends on the source Node
. In other words, source
may send messages to target in the RETE network. If the dependency edge is already present, this method call is a
noop.source
- the source nodetarget
- the target nodepublic boolean isInRecursiveGroup(Node node)
Node
is in a recursive CommunicationGroup
, false otherwise.public boolean areInSameGroup(Node left, Node right)
Node
s are in the same CommunicationGroup
.public void unregisterDependency(Node source, Node target)
source
- the source nodetarget
- the target nodeprotected boolean isRecursionCutPoint(Node source, Node target)
ProductionNode
s as cut point iff
both source and target belong to the same group.source
- the source nodetarget
- the target nodeprotected abstract void postProcessNode(Node node)
NetworkStructureChangeSensitiveNode
and BehaviorChangingMailbox
). At the time of the invocation,
the network topology has already been updated.protected abstract void postProcessGroup(CommunicationGroup group)
public abstract Mailbox proxifyMailbox(Node requester, Mailbox original)
Mailbox
for the given requester Node
. The proxy creation is
CommunicationTracker
-specific and depends on the identity of the requester. This method is primarily used
to create TimelyMailboxProxy
s depending on the network topology. There is no guarantee that the same
proxy instance is returned when this method is called multiple times with the same arguments.public abstract IndexerListener proxifyIndexerListener(Node requester, IndexerListener original)
IndexerListener
for the given requester Node
. The proxy creation is
CommunicationTracker
-specific and depends on the identity of the requester. This method is primarily used
to create TimelyIndexerListenerProxy
s depending on the network topology. There is no guarantee that the
same proxy instance is returned when this method is called multiple times with the same arguments.