Package org.eclipse.viatra.query.runtime.rete.single

## Class UniquenessEnforcerNode

- 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.AbstractUniquenessEnforcerNode
      - - org.eclipse.viatra.query.runtime.rete.single.UniquenessEnforcerNode

- All Implemented Interfaces:
    `IGroupable`, `NetworkStructureChangeSensitiveNode`, `Node`, `PosetAwareReceiver`, `Receiver`, `RederivableNode`, `Supplier`, `Tunnel`
  Direct Known Subclasses:
    `DefaultProductionNode`

      public class UniquenessEnforcerNode
      extends AbstractUniquenessEnforcerNode
      implements RederivableNode, PosetAwareReceiver

  Timeless uniqueness enforcer node implementation.

  The node is capable of operating in the delete and re-derive mode. In this mode, it is also possible to equip the node with an `IPosetComparator` to identify monotone changes; thus, ensuring that a fix-point can be reached during the evaluation.

  No Extend:
    This class is not intended to be subclassed by clients.
  No Instantiate:
    This class is not intended to be instantiated by clients.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected TupleMask` | `coreMask` | OPTIONAL ELEMENT - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
    `protected CommunicationGroup` | `currentGroup` |
    `protected boolean` | `deleteRederiveEvaluation` |
    `protected IMultiset<Tuple>` | `memory` |
    `protected IPosetComparator` | `posetComparator` | OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
    `protected TupleMask` | `posetMask` | OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
    `protected IMultiset<Tuple>` | `rederivableMemory` |

    - ### Fields inherited from class org.eclipse.viatra.query.runtime.rete.single.AbstractUniquenessEnforcerNode

      `identityMask, mailbox, memoryIdentityIndexer, memoryNullIndexer, nullMask, parents, specializedListeners, tupleWidth`

    - ### 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
    --- | ---
    `UniquenessEnforcerNode​(ReteContainer reteContainer, int tupleWidth)` |
    `UniquenessEnforcerNode​(ReteContainer reteContainer, int tupleWidth, boolean deleteRederiveEvaluation)` |
    `UniquenessEnforcerNode​(ReteContainer reteContainer, int tupleWidth, boolean deleteRederiveEvaluation, TupleMask coreMask, TupleMask posetMask, IPosetComparator posetComparator)` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `TupleMask` | `getCoreMask()` |
    `CommunicationGroup` | `getCurrentGroup()` |
    `ProjectionIndexer` | `getIdentityIndexer()` |
    `ProjectionIndexer` | `getNullIndexer()` |
    `IPosetComparator` | `getPosetComparator()` |
    `TupleMask` | `getPosetMask()` |
    `java.util.Set<Tuple>` | `getTuples()` |
    `protected Mailbox` | `instantiateMailbox()` |
    `boolean` | `isInDRedMode()` | Returns true if this node actually runs in DRed mode (not necessarily).
    `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` | `rederiveOne()` | The method is called by the `ReteContainer` to re-derive tuples after the normal messages have been delivered and consumed.
    `void` | `setCurrentGroup​(CommunicationGroup currentGroup)` | Sets the current group of the mailbox
    `void` | `update​(Direction direction, Tuple update, Timestamp timestamp)` | Updates the receiver with a newly found or lost partial matching.
    `protected boolean` | `updateDefault​(Direction direction, Tuple update)` |
    `protected boolean` | `updateWithDeleteAndRederive​(Direction direction, Tuple update, boolean monotone)` |
    `void` | `updateWithPosetInfo​(Direction direction, Tuple update, boolean monotone)` | Updates the receiver with a newly found or lost partial matching also providing information whether the update is a monotone change or not.

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.rete.single.AbstractUniquenessEnforcerNode

      `appendParent, assignTraceInfo, constructIndex, getMailbox, getParents, propagate, removeParent`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.rete.network.StandardNode

      `appendChild, getChildMailboxes, getPulledContents, getReceivers, issueError, networkStructureChanged, 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

      `appendParent, batchUpdate, getMailbox, getParents, removeParent`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.rete.network.Supplier

      `appendChild, getPulledContents, getPulledContents, getReceivers, removeChild`

- - ### Field Detail

    - #### memory

          protected IMultiset<Tuple> memory

    - #### rederivableMemory

          protected IMultiset<Tuple> rederivableMemory

      Since:
        1.6

    - #### deleteRederiveEvaluation

          protected boolean deleteRederiveEvaluation

      Since:
        1.6

    - #### currentGroup

          protected CommunicationGroup currentGroup

      Since:
        1.7

    - #### coreMask

          protected final TupleMask coreMask

      OPTIONAL ELEMENT - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
      Since:
        1.6

    - #### posetMask

          protected final TupleMask posetMask

      OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
      Since:
        1.6

    - #### posetComparator

          protected final IPosetComparator posetComparator

      OPTIONAL ELEMENTS - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
      Since:
        1.6

  - ### Constructor Detail

    - #### UniquenessEnforcerNode

          public UniquenessEnforcerNode​(ReteContainer reteContainer,
                                        int tupleWidth)

    - #### UniquenessEnforcerNode

          public UniquenessEnforcerNode​(ReteContainer reteContainer,
                                        int tupleWidth,
                                        boolean deleteRederiveEvaluation)

      Since:
        1.6

    - #### UniquenessEnforcerNode

          public UniquenessEnforcerNode​(ReteContainer reteContainer,
                                        int tupleWidth,
                                        boolean deleteRederiveEvaluation,
                                        TupleMask coreMask,
                                        TupleMask posetMask,
                                        IPosetComparator posetComparator)

      Since:
        1.6

  - ### Method Detail

    - #### 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.
      Specified by:
        `pullInto` in interface `Supplier`
        `flush` - if true, flushing of messages is allowed during the pull, otherwise flushing is not allowed

    - #### getTuples

          public java.util.Set<Tuple> getTuples()

      Specified by:
        `getTuples` in class `AbstractUniquenessEnforcerNode`
      Since:
        2.8

    - #### isInDRedMode

          public boolean isInDRedMode()

      Description copied from interface: `RederivableNode`
      Returns true if this node actually runs in DRed mode (not necessarily).
      Specified by:
        `isInDRedMode` in interface `RederivableNode`
      Returns:
        true if the node is operating in DRed mode

    - #### getCoreMask

          public TupleMask getCoreMask()

      Specified by:
        `getCoreMask` in interface `PosetAwareReceiver`

    - #### getPosetMask

          public TupleMask getPosetMask()

      Specified by:
        `getPosetMask` in interface `PosetAwareReceiver`

    - #### getPosetComparator

          public IPosetComparator getPosetComparator()

      Specified by:
        `getPosetComparator` in interface `PosetAwareReceiver`

    - #### pullIntoWithTimeline

          public void pullIntoWithTimeline​(java.util.Map<Tuple,​Timeline<Timestamp>> collector,
                                           boolean flush)

      Specified by:
        `pullIntoWithTimeline` in interface `Supplier`

    - #### instantiateMailbox

          protected Mailbox instantiateMailbox()

      Specified by:
        `instantiateMailbox` in class `AbstractUniquenessEnforcerNode`
      Since:
        2.0

    - #### update

          public void update​(Direction direction,
                             Tuple update,
                             Timestamp timestamp)

      Description copied from interface: `Receiver`
      Updates the receiver with a newly found or lost partial matching.
      Specified by:
        `update` in interface `Receiver`

    - #### updateWithPosetInfo

          public void updateWithPosetInfo​(Direction direction,
                                          Tuple update,
                                          boolean monotone)

      Description copied from interface: `PosetAwareReceiver`
      Updates the receiver with a newly found or lost partial matching also providing information whether the update is a monotone change or not.
      Specified by:
        `updateWithPosetInfo` in interface `PosetAwareReceiver`
      Parameters:
        `direction` - the direction of the update
        `update` - the update tuple
        `monotone` - true if the update is monotone, false otherwise

    - #### updateWithDeleteAndRederive

          protected boolean updateWithDeleteAndRederive​(Direction direction,
                                                        Tuple update,
                                                        boolean monotone)

      Since:
        2.4

    - #### updateDefault

          protected boolean updateDefault​(Direction direction,
                                          Tuple update)

      Since:
        2.4

    - #### rederiveOne

          public void rederiveOne()

      Description copied from interface: `RederivableNode`
      The method is called by the `ReteContainer` to re-derive tuples after the normal messages have been delivered and consumed. The re-derivation process may trigger the creation and delivery of further messages and further re-derivation rounds.
      Specified by:
        `rederiveOne` in interface `RederivableNode`
      Since:
        1.6

    - #### getNullIndexer

          public ProjectionIndexer getNullIndexer()

      Specified by:
        `getNullIndexer` in class `AbstractUniquenessEnforcerNode`

    - #### getIdentityIndexer

          public ProjectionIndexer getIdentityIndexer()

      Specified by:
        `getIdentityIndexer` in class `AbstractUniquenessEnforcerNode`

    - #### getCurrentGroup

          public CommunicationGroup getCurrentGroup()

      Specified by:
        `getCurrentGroup` in interface `IGroupable`
      Returns:
        the current group of the mailbox

    - #### setCurrentGroup

          public void setCurrentGroup​(CommunicationGroup currentGroup)

      Description copied from interface: `IGroupable`
      Sets the current group of the mailbox
      Specified by:
        `setCurrentGroup` in interface `IGroupable`