org.eclipse.viatra.query.runtime.matchers.backend

## Interface IQueryResultProvider

- All Known Implementing Classes:
    LocalSearchResultProvider, RetePatternMatcher

      public interface IQueryResultProvider

  An internal interface of the query backend that provides results of a given query.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addUpdateListener(IUpdateable listener, java.lang.Object listenerTag, boolean fireNow)` Internal method that registers low-level callbacks for match appearance and disappearance.
    `int` | `countMatches(java.lang.Object[] parameters)` Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
    `java.util.Collection<? extends Tuple>` | `getAllMatches(java.lang.Object[] parameters)` Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
    `Tuple` | `getOneArbitraryMatch(java.lang.Object[] parameters)` Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
    `IQueryBackend` | `getQueryBackend()` The underlying query evaluator backend.
    `void` | `removeUpdateListener(java.lang.Object listenerTag)` Removes an existing listener previously registered with the given tag.

- - ### Method Detail

    - #### countMatches

          int countMatches(java.lang.Object[] parameters)

      Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
        `parameters` - array where each non-null element binds the corresponding pattern parameter to a fixed value.
      Returns:
        the number of pattern matches found.

    - #### getOneArbitraryMatch

          Tuple getOneArbitraryMatch(java.lang.Object[] parameters)

      Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed.
      Parameters:
        `parameters` - array where each non-null element binds the corresponding pattern parameter to a fixed value.
      Returns:
        a match represented in the internal `Tuple` representation.

    - #### getAllMatches

          java.util.Collection<? extends Tuple> getAllMatches(java.lang.Object[] parameters)

      Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
      Parameters:
        `parameters` - array where each non-null element binds the corresponding pattern parameter to a fixed value.
      Returns:
        matches represented in the internal `Tuple` representation.

    - #### getQueryBackend

          IQueryBackend getQueryBackend()

      The underlying query evaluator backend.

    - #### addUpdateListener

          void addUpdateListener(IUpdateable listener,
                                 java.lang.Object listenerTag,
                                 boolean fireNow)

      Internal method that registers low-level callbacks for match appearance and disappearance.

      Caution: This is a low-level callback that is invoked when the pattern matcher is not necessarily in a consistent state yet. Importantly, no model modification permitted during the callback.

      The callback can be unregistered via invoking `removeUpdateListener(Object)` with the same tag.

      Parameters:
        `listener` - the listener that will be notified of each new match that appears or disappears, starting from now.
        `listenerTag` - a tag by which to identify the listener for later removal by `removeUpdateListener(Object)`.
        `fireNow` - if true, the insertion update allback will be immediately invoked on all current matches as a one-time effect.
      Throws:
        `java.lang.UnsupportedOperationException` - if this is a non-incremental backend (i.e. `IQueryBackend.isCaching()` on `getQueryBackend()` returns false)

    - #### removeUpdateListener

          void removeUpdateListener(java.lang.Object listenerTag)

      Removes an existing listener previously registered with the given tag.
      Throws:
        `java.lang.UnsupportedOperationException` - if this is a non-incremental backend (i.e. `IQueryBackend.isCaching()` on `getQueryBackend()` returns false)