org.eclipse.incquery.runtime.matchers.tuple

## Class Tuple

- java.lang.Object
- - org.eclipse.incquery.runtime.matchers.tuple.Tuple

- Direct Known Subclasses:
    FlatTuple, LeftInheritanceTuple, MaskedTuple, MatchingFrame

      public abstract class Tuple
      extends java.lang.Object

  Immutable tuple.
  Author:
    Gabor Bergmann

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)`
    `abstract java.lang.Object` | `get(int index)`
    `<T> java.util.Set<T>` | `getDistinctElements()`
    `java.lang.Object[]` | `getElements()` As the tuple is supposed to be immutable, do not modify the returned array.
    `abstract int` | `getSize()`
    `int` | `hashCode()`
    `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.
    `Tuple` | `replaceAll(java.lang.Object obsolete, java.lang.Object replacement)`
    `java.lang.String` | `toString()`

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

      `getClass, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getSize

          public abstract int getSize()

      Returns:
        number of elements

    - #### get

          public abstract java.lang.Object get(int index)

      Returns:
        the element at the specified index

    - #### getElements

          public java.lang.Object[] getElements()

      As the tuple is supposed to be immutable, do not modify the returned array.
      Returns:
        the array containing all elements of this Tuple

    - #### getDistinctElements

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

      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.
      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.
      Returns:
        the inverted index mapping each element of this pattern to its index in the array

    - #### equals

          public boolean equals(java.lang.Object obj)

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

    - #### hashCode

          public int hashCode()

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

    - #### toString

          public java.lang.String toString()

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

    - #### replaceAll

          public Tuple replaceAll(java.lang.Object obsolete,
                                  java.lang.Object replacement)