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.UniquenessEnforcerNode

- All Implemented Interfaces:
    MonotonicityAwareReceiver, Node, Receiver, RederivableNode, Supplier, Tunnel
  Direct Known Subclasses:
    DefaultProductionNode

      public class UniquenessEnforcerNode
      extends StandardNode
      implements Tunnel, RederivableNode, MonotonicityAwareReceiver

  Ensures that no identical copies get to the output. Only one replica of each pattern substitution may traverse this node. 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 Instantiate:
    This class is not intended to be instantiated by clients.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TupleMask` | `coreMask` OPTIONAL ELEMENT - ONLY PRESENT IF MONOTONICITY INFO WAS AVAILABLE
    `protected boolean` | `deleteRederiveEvaluation`
    `protected Mailbox` | `mailbox`
    `protected TupleMemory` | `memory`
    `protected MemoryIdentityIndexer` | `memoryIdentityIndexer`
    `protected MemoryNullIndexer` | `memoryNullIndexer`
    `protected java.util.Collection<Supplier>` | `parents`
    `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 TupleMemory` | `rederivableMemory`
    `protected int` | `tupleWidth`

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

      `children`

    - ### Fields inherited from class org.eclipse.viatra.query.runtime.rete.network.BaseNode

      `nodeId, reteContainer, tag, traceInfos`

  - ### Constructor Summary

    Constructors
    Constructor and 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 and Description
    --- | ---
    `void` | `appendParent(Supplier supplier)` appends a parent that will continously send insert and revoke updates to this supplier
    `void` | `assignTraceInfo(TraceInfo traceInfo)` assigns new traceability info to this node
    `ProjectionIndexer` | `constructIndex(TupleMask mask, TraceInfo... traces)` Instantiates (or reuses, depending on implementation) an index according to the given mask.
    `TupleMask` | `getCoreMask()`
    `MemoryIdentityIndexer` | `getIdentityIndexer()`
    `Mailbox` | `getMailbox()` Returns the `Mailbox` of this receiver.
    `TupleMemory` | `getMemory()`
    `MemoryNullIndexer` | `getNullIndexer()`
    `java.util.Collection<Supplier>` | `getParents()` access active parent
    `IPosetComparator` | `getPosetComparator()`
    `TupleMask` | `getPosetMask()`
    `protected Mailbox` | `instantiateMailbox()`
    `protected void` | `propagate(Direction direction, Tuple update)`
    `void` | `pullInto(java.util.Collection<Tuple> collector)` pulls the contents of this object in this particular moment into a target collection
    `void` | `rederiveOne()` The method is called by the `ReteContainer` to re-derive tuples after the normal messages have been delivered and consumed.
    `void` | `removeParent(Supplier supplier)` removes a parent
    `void` | `update(Direction direction, Tuple update)` updates the receiver with a newly found or lost partial matching
    `void` | `update(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.
    `protected boolean` | `updateDefault(Direction direction, Tuple update)`
    `protected boolean` | `updateWithDeleteAndRederive(Direction direction, Tuple update, boolean monotone)`

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

      `appendChild, 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.Supplier

      `appendChild, getPulledContents, getReceivers, removeChild`

- - ### Field Detail

    - #### parents

          protected java.util.Collection<Supplier> parents

    - #### memory

          protected TupleMemory memory

    - #### rederivableMemory

          protected TupleMemory rederivableMemory

      Since:
        1.6

    - #### deleteRederiveEvaluation

          protected boolean deleteRederiveEvaluation

      Since:
        1.6

    - #### memoryNullIndexer

          protected MemoryNullIndexer memoryNullIndexer

    - #### memoryIdentityIndexer

          protected MemoryIdentityIndexer memoryIdentityIndexer

    - #### tupleWidth

          protected final int tupleWidth

    - #### mailbox

          protected final Mailbox mailbox

      Since:
        1.6

    - #### 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

    - #### getCoreMask

          public TupleMask getCoreMask()

      Specified by:
        `getCoreMask` in interface `MonotonicityAwareReceiver`

    - #### getPosetMask

          public TupleMask getPosetMask()

      Specified by:
        `getPosetMask` in interface `MonotonicityAwareReceiver`

    - #### getPosetComparator

          public IPosetComparator getPosetComparator()

      Specified by:
        `getPosetComparator` in interface `MonotonicityAwareReceiver`

    - #### instantiateMailbox

          protected Mailbox instantiateMailbox()

      Since:
        1.6

    - #### getMemory

          public TupleMemory getMemory()

    - #### getMailbox

          public Mailbox getMailbox()

      Description copied from interface: `Receiver`
      Returns the `Mailbox` of this receiver.
      Specified by:
        `getMailbox` in interface `Receiver`
      Returns:
        the mailbox

    - #### update

          public void update(Direction direction,
                             Tuple update)

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

    - #### update

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

      Description copied from interface: `MonotonicityAwareReceiver`
      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:
        `update` in interface `MonotonicityAwareReceiver`
      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:
        1.6

    - #### updateDefault

          protected boolean updateDefault(Direction direction,
                                          Tuple update)

      Since:
        1.6

    - #### 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

    - #### propagate

          protected void propagate(Direction direction,
                                   Tuple update)

      Since:
        1.6

    - #### constructIndex

          public ProjectionIndexer constructIndex(TupleMask mask,
                                                  TraceInfo... traces)

      Description copied from interface: `Supplier`
      Instantiates (or reuses, depending on implementation) an index according to the given mask. Intended for internal use; clients should invoke through Library instead to enable reusing.
      Specified by:
        `constructIndex` in interface `Supplier`
      Overrides:
        `constructIndex` in class `StandardNode`

    - #### pullInto

          public void pullInto(java.util.Collection<Tuple> collector)

      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`

    - #### getNullIndexer

          public MemoryNullIndexer getNullIndexer()

    - #### getIdentityIndexer

          public MemoryIdentityIndexer getIdentityIndexer()

    - #### appendParent

          public void appendParent(Supplier supplier)

      Description copied from interface: `Receiver`
      appends a parent that will continously send insert and revoke updates to this supplier
      Specified by:
        `appendParent` in interface `Receiver`

    - #### removeParent

          public void removeParent(Supplier supplier)

      Description copied from interface: `Receiver`
      removes a parent
      Specified by:
        `removeParent` in interface `Receiver`

    - #### getParents

          public java.util.Collection<Supplier> getParents()

      Description copied from interface: `Receiver`
      access active parent
      Specified by:
        `getParents` in interface `Receiver`

    - #### assignTraceInfo

          public void assignTraceInfo(TraceInfo traceInfo)

      Description copied from interface: `Node`
      assigns new traceability info to this node
      Specified by:
        `assignTraceInfo` in interface `Node`
      Overrides:
        `assignTraceInfo` in class `BaseNode`