org.eclipse.viatra.query.runtime.matchers.scopes.tables

## Class AbstractIndexTable

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.scopes.tables.AbstractIndexTable

- All Implemented Interfaces:
    IIndexTable
  Direct Known Subclasses:
    DefaultIndexTable, DisjointUnionTable, SimpleBinaryTable, SimpleUnaryTable

      public abstract class AbstractIndexTable
      extends java.lang.Object
      implements IIndexTable

  EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same.

  Since:
    2.0

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `AbstractIndexTable.ColumnBoundListeners` Listeners interested in all tuples seeded by a single columns
    `protected class` | `AbstractIndexTable.GenericBoundListeners` Listeners interested in all tuples seeded by a tuple of values
    `protected static interface` | `AbstractIndexTable.IListenersWithSameMask` Represents all listeners subscribed to seeds with the given seed mask.
    `protected class` | `AbstractIndexTable.UniversalListeners` Listeners interested in all tuples

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `emitNotifications`
    `protected TupleMask` | `emptyMask`
    `protected Tuple` | `emptyTuple`
    `protected java.util.List<AbstractIndexTable.IListenersWithSameMask>` | `listenerGroups`
    `protected ITableContext` | `tableContext`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractIndexTable(IInputKey inputKey, ITableContext tableContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addUpdateListener(Tuple seed, IQueryRuntimeContextListener listener)` Subscribes for updates in the table, optionally seeded with the given tuple.
    `protected void` | `deliverChangeNotifications(Tuple updateTuple, boolean isInsertion)` Implementors shall call this to deliver all notifications.
    `IInputKey` | `getInputKey()`
    `protected AbstractIndexTable.IListenersWithSameMask` | `getListenerGroup(TupleMask seedMask)`
    `protected void` | `logError(java.lang.String message)`
    `void` | `removeUpdateListener(Tuple seed, IQueryRuntimeContextListener listener)` Unsubscribes from updates in the table, optionally seeded with the given tuple.
    `java.lang.String` | `toString()`

    - ### 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.matchers.scopes.tables.IIndexTable

      `containsTuple, countTuples, enumerateTuples, enumerateValues, estimateProjectionSize, streamTuples, streamValues`

- - ### Field Detail

    - #### tableContext

          protected ITableContext tableContext

    - #### emptyMask

          protected final TupleMask emptyMask

    - #### emptyTuple

          protected final Tuple emptyTuple

    - #### emitNotifications

          protected boolean emitNotifications

    - #### listenerGroups

          protected java.util.List<AbstractIndexTable.IListenersWithSameMask> listenerGroups

  - ### Constructor Detail

    - #### AbstractIndexTable

          public AbstractIndexTable(IInputKey inputKey,
                                    ITableContext tableContext)

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### getInputKey

          public IInputKey getInputKey()

      Specified by:
        `getInputKey` in interface `IIndexTable`
      Returns:
        the input key indexed by this table

    - #### logError

          protected void logError(java.lang.String message)

    - #### deliverChangeNotifications

          protected void deliverChangeNotifications(Tuple updateTuple,
                                                    boolean isInsertion)

      Implementors shall call this to deliver all notifications. Call may be conditioned to `emitNotifications`

    - #### addUpdateListener

          public void addUpdateListener(Tuple seed,
                                        IQueryRuntimeContextListener listener)

      Description copied from interface: `IIndexTable`
      Subscribes for updates in the table, optionally seeded with the given tuple.

      This should be called after initializing a result cache by an enumeration method.

      Specified by:
        `addUpdateListener` in interface `IIndexTable`
      Parameters:
        `seed` - can be null or a tuple with matching arity; if non-null, notifications will delivered only about those updates of the table that match the seed at positions where the seed is non-null.
        `listener` - will be notified of future changes

    - #### removeUpdateListener

          public void removeUpdateListener(Tuple seed,
                                           IQueryRuntimeContextListener listener)

      Description copied from interface: `IIndexTable`
      Unsubscribes from updates in the table, optionally seeded with the given tuple.
      Specified by:
        `removeUpdateListener` in interface `IIndexTable`
      Parameters:
        `seed` - can be null or a tuple with matching arity; see `IIndexTable.addUpdateListener(Tuple, IQueryRuntimeContextListener)` for definition.
        `listener` - will no longer be notified of future changes

    - #### getListenerGroup

          protected AbstractIndexTable.IListenersWithSameMask getListenerGroup(TupleMask seedMask)