org.eclipse.viatra.query.runtime.api.scope

## Interface IBaseIndex

- All Known Implementing Classes:
    EMFBaseIndexWrapper

      public interface IBaseIndex

  Represents the index maintained on the model.
  Since:
    0.9

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addBaseIndexChangeListener(ViatraBaseIndexChangeListener listener)` Adds a coarse-grained listener that will be invoked after the NavigationHelper index or the underlying model is changed.
    `boolean` | `addIndexingErrorListener(IIndexingErrorListener listener)` Adds a listener for internal errors in the index.
    `boolean` | `addInstanceObserver(IInstanceObserver observer, java.lang.Object observedObject)` Register a lightweight observer that is notified if any edge starting at the given Object changes.
    `<V> V` | `coalesceTraversals(java.util.concurrent.Callable<V> callable)` The given callback will be executed, and all model traversals and index registrations will be delayed until the execution is done.
    `void` | `removeBaseIndexChangeListener(ViatraBaseIndexChangeListener listener)` Removes a registered listener.
    `boolean` | `removeIndexingErrorListener(IIndexingErrorListener listener)` Removes a listener for internal errors in the index
    `boolean` | `removeInstanceObserver(IInstanceObserver observer, java.lang.Object observedObject)` Unregisters a lightweight observer for the given Object.
    `void` | `resampleDerivedFeatures()` Updates the value of indexed derived features that are not well-behaving.

- - ### Method Detail

    - #### coalesceTraversals

          <V> V coalesceTraversals(java.util.concurrent.Callable<V> callable)
                            throws java.lang.reflect.InvocationTargetException

      The given callback will be executed, and all model traversals and index registrations will be delayed until the execution is done. If there are any outstanding feature, class or datatype registrations, a single coalesced model traversal will initialize the caches and deliver the notifications.
      Parameters:
        `callable` -
      Throws:
        `java.lang.reflect.InvocationTargetException`

    - #### addBaseIndexChangeListener

          void addBaseIndexChangeListener(ViatraBaseIndexChangeListener listener)

      Adds a coarse-grained listener that will be invoked after the NavigationHelper index or the underlying model is changed. Can be used e.g. to check model contents. Not intended for general use.

      See `removeBaseIndexChangeListener(ViatraBaseIndexChangeListener)`
      Parameters:
        `listener` -

    - #### removeBaseIndexChangeListener

          void removeBaseIndexChangeListener(ViatraBaseIndexChangeListener listener)

      Removes a registered listener.

      See `addBaseIndexChangeListener(ViatraBaseIndexChangeListener)`
      Parameters:
        `listener` -

    - #### resampleDerivedFeatures

          void resampleDerivedFeatures()

      Updates the value of indexed derived features that are not well-behaving.

    - #### addIndexingErrorListener

          boolean addIndexingErrorListener(IIndexingErrorListener listener)

      Adds a listener for internal errors in the index. A listener can only be added once.
      Parameters:
        `listener` -
      Since:
        0.8.0

    - #### removeIndexingErrorListener

          boolean removeIndexingErrorListener(IIndexingErrorListener listener)

      Removes a listener for internal errors in the index
      Parameters:
        `listener` -
      Since:
        0.8.0

    - #### addInstanceObserver

          boolean addInstanceObserver(IInstanceObserver observer,
                                      java.lang.Object observedObject)

      Register a lightweight observer that is notified if any edge starting at the given Object changes.
      Parameters:
        `observer` - the listener instance
        `observedObject` - the observed instance object
      Returns:
        false if no observer can be registered for the given instance (e.g. it is a primitive), or observer was already registered (call has no effect)

    - #### removeInstanceObserver

          boolean removeInstanceObserver(IInstanceObserver observer,
                                         java.lang.Object observedObject)

      Unregisters a lightweight observer for the given Object.
      Parameters:
        `observer` - the listener instance
        `observedObject` - the observed instance object
      Returns:
        false if no observer can be registered for the given instance (e.g. it is a primitive), or no observer was registered previously (call has no effect)