org.eclipse.viatra.query.runtime.matchers.tuple

## Class AbstractTuple

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.tuple.AbstractTuple

- All Implemented Interfaces:
    ITuple
  Direct Known Subclasses:
    Tuple, VolatileTuple

      public abstract class AbstractTuple
      extends java.lang.Object
      implements ITuple

  Common implementation methods for immutable and volatile tuples. The class should not be used directly in client code, except for the definition of new tuple implementations.
  Since:
    1.7

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractTuple()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `doCalcHash()`
    `<T> java.util.Set<T>` | `getDistinctElements()`
    `java.lang.Object[]` | `getElements()` As the tuple is supposed to be immutable, do not modify the returned array.
    `protected boolean` | `internalEquals(ITuple other)` Compares the elements stored in this tuple to another tuple
    `java.util.Map<java.lang.Object,java.lang.Integer>` | `invertIndex()` Calculates an inverted index of the elements of this pattern.
    `java.util.Map<java.lang.Object,java.util.List<java.lang.Integer>>` | `invertIndexWithMupliplicity()` Calculates an inverted index of the elements of this pattern.
    `protected java.lang.IndexOutOfBoundsException` | `raiseIndexingError(int index)`
    `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.tuple.ITuple

      `get, getSize, toImmutable`

- - ### Constructor Detail

    - #### AbstractTuple

          public AbstractTuple()

  - ### Method Detail

    - #### getElements

          public java.lang.Object[] getElements()

      As the tuple is supposed to be immutable, do not modify the returned array.
      Specified by:
        `getElements` in interface `ITuple`
      Returns:
        the array containing all elements of this Tuple

    - #### getDistinctElements

          public <T> java.util.Set<T> getDistinctElements()

      Specified by:
        `getDistinctElements` in interface `ITuple`
      Returns:
        the set containing all distinct elements of this Tuple, cast as type T

    - #### invertIndex

          public java.util.Map<java.lang.Object,java.lang.Integer> invertIndex()

      Calculates an inverted index of the elements of this pattern. For each element, the index of the (last) occurrence is calculated.
      Specified by:
        `invertIndex` in interface `ITuple`
      Returns:
        the inverted index mapping each element of this pattern to its index in the array

    - #### invertIndexWithMupliplicity

          public java.util.Map<java.lang.Object,java.util.List<java.lang.Integer>> invertIndexWithMupliplicity()

      Calculates an inverted index of the elements of this pattern. For each element, the index of all of its occurrences is calculated.
      Specified by:
        `invertIndexWithMupliplicity` in interface `ITuple`
      Returns:
        the inverted index mapping each element of this pattern to its index in the array

    - #### raiseIndexingError

          protected java.lang.IndexOutOfBoundsException raiseIndexingError(int index)

      Since:
        1.7

    - #### internalEquals

          protected boolean internalEquals(ITuple other)

      Compares the elements stored in this tuple to another tuple

    - #### toString

          public java.lang.String toString()

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

    - #### doCalcHash

          protected int doCalcHash()

      Since:
        1.7