org.eclipse.viatra.query.runtime.localsearch

## Class MatchingFrame

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

- All Implemented Interfaces:
    IModifiableTuple, ITuple

      public class MatchingFrame
      extends VolatileTuple
      implements IModifiableTuple

  A MatchingFrame is a Volatile Tuple implementation used by the local search engine internally.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MatchingFrame(int frameSize)`
    `MatchingFrame(MatchingFrame other)` Creates a copy of another matching frame; the two frames can be updated separately

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(int index)`
    `java.lang.Object[]` | `getElements()` As the tuple is supposed to be immutable, do not modify the returned array.
    `int` | `getSize()`
    `java.lang.Object` | `getValue(int position)` Returns the value stored inside the matching frame.
    `void` | `set(int index, java.lang.Object value)` Sets the selected value for a tuple
    `void` | `setValue(int position, java.lang.Object value)` Sets the value of the variable at the given position.
    `boolean` | `testAndSetValue(java.lang.Integer position, java.lang.Object value)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.matchers.tuple.VolatileTuple

      `equals, hashCode, toImmutable`

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.matchers.tuple.AbstractTuple

      `doCalcHash, getDistinctElements, internalEquals, invertIndex, invertIndexWithMupliplicity, raiseIndexingError`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.tuple.ITuple

      `getDistinctElements, invertIndex, invertIndexWithMupliplicity, toImmutable`

- - ### Constructor Detail

    - #### MatchingFrame

          public MatchingFrame(int frameSize)

      Since:
        1.7

    - #### MatchingFrame

          public MatchingFrame(MatchingFrame other)

      Creates a copy of another matching frame; the two frames can be updated separately
      Parameters:
        `other` -
      Since:
        1.7

  - ### Method Detail

    - #### getValue

          public java.lang.Object getValue(int position)

      Returns the value stored inside the matching frame.
      Parameters:
        `position` -
      Returns:
        the element stored in the selected position in the frame, or null if it is not yet set
      Throws:
        `java.lang.IndexOutOfBoundsException` - if position is negative
        `java.lang.IllegalArgumentException` - if the position is larger then the length of the frame

    - #### setValue

          public void setValue(int position,
                               java.lang.Object value)

      Sets the value of the variable at the given position. For internal use in LS matching only.
      Parameters:
        `position` - the position of the variable within the frame
        `value` - the value to be set for the variable

    - #### testAndSetValue

          public boolean testAndSetValue(java.lang.Integer position,
                                         java.lang.Object value)

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `AbstractTuple`

    - #### getSize

          public int getSize()

      Specified by:
        `getSize` in interface `ITuple`
      Returns:
        number of elements

    - #### get

          public java.lang.Object get(int index)

      Specified by:
        `get` in interface `ITuple`
      Returns:
        the element at the specified index

    - #### getElements

          public java.lang.Object[] getElements()

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

    - #### set

          public void set(int index,
                          java.lang.Object value)

      Description copied from interface: `IModifiableTuple`
      Sets the selected value for a tuple
      Specified by:
        `set` in interface `IModifiableTuple`