org.eclipse.viatra.query.runtime.rete.network

## Class CommunicationTracker

- java.lang.Object
- - org.eclipse.viatra.query.runtime.rete.network.CommunicationTracker

-     public final class CommunicationTracker
      extends java.lang.Object

  An instance of this class is associated with every `ReteContainer`. The tracker serves two purposes:
  (1) It allows RETE nodes to register their communication dependencies on-the-fly. These dependencies can be registered or unregistered when nodes are disposed of.
  (2) It allows RETE nodes to register their mailboxes as dirty, that is, they can tell the tracker that they have something to send to other nodes in the network. The tracker is then responsible for ordering these messages (more precisely, the mailboxes that contain the messages) for the associated `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.
  Since:
    1.6

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CommunicationTracker()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRederivable(RederivableNode node)`
    `protected CommunicationGroup` | `createAndStoreGroup(Node representative, int index)`
    `CommunicationGroup` | `getAndRemoveFirstGroup()`
    `boolean` | `isEmpty()`
    `void` | `notifyHasMessage(Mailbox mailbox, MessageKind kind)`
    `void` | `notifyLostAllMessages(Mailbox mailbox, MessageKind kind)`
    `void` | `registerDependency(Node source, Node target)` Registers the dependency that the target `Node` depends on the source `Node`.
    `void` | `removeRederivable(RederivableNode node)`
    `void` | `unregisterDependency(Node source, Node target)` Unregisters a dependency between source and target.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### CommunicationTracker

          public CommunicationTracker()

  - ### Method Detail

    - #### addRederivable

          public void addRederivable(RederivableNode node)

    - #### removeRederivable

          public void removeRederivable(RederivableNode node)

    - #### notifyHasMessage

          public void notifyHasMessage(Mailbox mailbox,
                                       MessageKind kind)

    - #### notifyLostAllMessages

          public void notifyLostAllMessages(Mailbox mailbox,
                                            MessageKind kind)

    - #### getAndRemoveFirstGroup

          public CommunicationGroup getAndRemoveFirstGroup()

    - #### isEmpty

          public boolean isEmpty()

    - #### createAndStoreGroup

          protected CommunicationGroup createAndStoreGroup(Node representative,
                                                           int index)

    - #### registerDependency

          public void registerDependency(Node source,
                                         Node target)

      Registers the dependency that the target `Node` depends on the source `Node`. In other words, source may send messages to target in the RETE network.
      Parameters:
        `source` - the source node
        `target` - the target node

    - #### unregisterDependency

          public void unregisterDependency(Node source,
                                           Node target)

      Unregisters a dependency between source and target.
      Parameters:
        `source` - the source node
        `target` - the target node