org.eclipse.viatra.query.runtime.localsearch.matcher.integration

## Class LocalSearchResultProvider

- java.lang.Object
- - org.eclipse.viatra.query.runtime.localsearch.matcher.integration.LocalSearchResultProvider

- All Implemented Interfaces:
    IQueryResultProvider

      public class LocalSearchResultProvider
      extends java.lang.Object
      implements IQueryResultProvider

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider)`
    `LocalSearchResultProvider(LocalSearchBackend backend, IQueryBackendContext context, PQuery query, IPlanProvider planProvider, QueryEvaluationHint userHints)`

  - ### Method Summary

    All Methods Instance Methods Concrete 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.
    `IMatcherCapability` | `getCapabilites()`
    `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.
    `LocalSearchMatcher` | `newLocalSearchMatcher(java.lang.Object[] parameters)`
    `void` | `prepare()` Prepare this result provider.
    `void` | `removeUpdateListener(java.lang.Object listenerTag)` Removes an existing listener previously registered with the given tag.

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### LocalSearchResultProvider

          public LocalSearchResultProvider(LocalSearchBackend backend,
                                           IQueryBackendContext context,
                                           PQuery query,
                                           IPlanProvider planProvider)
                                    throws QueryProcessingException

      Throws:
        `QueryProcessingException`
      Since:
        1.5

    - #### LocalSearchResultProvider

          public LocalSearchResultProvider(LocalSearchBackend backend,
                                           IQueryBackendContext context,
                                           PQuery query,
                                           IPlanProvider planProvider,
                                           QueryEvaluationHint userHints)
                                    throws QueryProcessingException

      Throws:
        `QueryProcessingException`
      Since:
        1.5

  - ### Method Detail

    - #### prepare

          public void prepare()
                       throws QueryProcessingException

      Prepare this result provider. This phase is separated from the constructor to allow the backend to cache its instance before requesting preparation for its dependencies.
      Throws:
        `QueryProcessingException`
      Since:
        1.5

    - #### newLocalSearchMatcher

          public LocalSearchMatcher newLocalSearchMatcher(java.lang.Object[] parameters)
                                                   throws ViatraQueryException,
                                                          QueryProcessingException

      Throws:
        `ViatraQueryException`
        `QueryProcessingException`

    - #### getOneArbitraryMatch

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

      Description copied from interface: `IQueryResultProvider`
      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.
      Specified by:
        `getOneArbitraryMatch` in interface `IQueryResultProvider`
      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.

    - #### countMatches

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

      Description copied from interface: `IQueryResultProvider`
      Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
      Specified by:
        `countMatches` in interface `IQueryResultProvider`
      Parameters:
        `parameters` - array where each non-null element binds the corresponding pattern parameter to a fixed value.
      Returns:
        the number of pattern matches found.

    - #### getAllMatches

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

      Description copied from interface: `IQueryResultProvider`
      Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
      Specified by:
        `getAllMatches` in interface `IQueryResultProvider`
      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

          public IQueryBackend getQueryBackend()

      Description copied from interface: `IQueryResultProvider`
      The underlying query evaluator backend.
      Specified by:
        `getQueryBackend` in interface `IQueryResultProvider`

    - #### addUpdateListener

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

      Description copied from interface: `IQueryResultProvider`
      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 `IQueryResultProvider.removeUpdateListener(Object)` with the same tag.

      Specified by:
        `addUpdateListener` in interface `IQueryResultProvider`
      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 `IQueryResultProvider.removeUpdateListener(Object)`.
        `fireNow` - if true, the insertion update allback will be immediately invoked on all current matches as a one-time effect.

    - #### removeUpdateListener

          public void removeUpdateListener(java.lang.Object listenerTag)

      Description copied from interface: `IQueryResultProvider`
      Removes an existing listener previously registered with the given tag.
      Specified by:
        `removeUpdateListener` in interface `IQueryResultProvider`

    - #### getCapabilites

          public IMatcherCapability getCapabilites()

      Since:
        1.4