org.eclipse.viatra.query.runtime.base.api

## Class ViatraBaseFactory

- java.lang.Object
- - org.eclipse.viatra.query.runtime.base.api.ViatraBaseFactory

-     public class ViatraBaseFactory
      extends java.lang.Object

  Factory class for the utils in the library:
  - NavigationHelper (automatic and manual)
  - TransitiveClosureUtil

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `ViatraBaseFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `NavigationHelper` | `createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot, BaseIndexOptions options, org.apache.log4j.Logger logger)` The method creates a `NavigationHelper` index for the given EMF model root.
    `NavigationHelper` | `createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot, boolean wildcardMode, boolean dynamicModel, org.apache.log4j.Logger logger)` The method creates a `NavigationHelper` index for the given EMF model root.
    `NavigationHelper` | `createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot, boolean wildcardMode, org.apache.log4j.Logger logger)` The method creates a `NavigationHelper` index for the given EMF model root.
    `TransitiveClosureHelper` | `createTransitiveClosureHelper(NavigationHelper baseIndex, java.util.Set<org.eclipse.emf.ecore.EReference> referencesToObserve)` The method creates a TransitiveClosureHelper instance built on an existing NavigationHelper.
    `TransitiveClosureHelper` | `createTransitiveClosureHelper(org.eclipse.emf.common.notify.Notifier emfRoot, java.util.Set<org.eclipse.emf.ecore.EReference> referencesToObserve)` The method creates a TransitiveClosureHelper instance for the given EMF model root.
    `static ViatraBaseFactory` | `getInstance()` Get the singleton instance of ViatraBaseFactory.

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

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

- - ### Constructor Detail

    - #### ViatraBaseFactory

          protected ViatraBaseFactory()

  - ### Method Detail

    - #### getInstance

          public static ViatraBaseFactory getInstance()

      Get the singleton instance of ViatraBaseFactory.
      Returns:
        the singleton instance

    - #### createNavigationHelper

          public NavigationHelper createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot,
                                                         boolean wildcardMode,
                                                         org.apache.log4j.Logger logger)

      The method creates a `NavigationHelper` index for the given EMF model root. A new instance will be created on every call.

      A NavigationHelper in wildcard mode will process and index all EStructuralFeatures, EClasses and EDatatypes. If wildcard mode is off, the client will have to manually register the interesting aspects of the model.

      The NavigationHelper will be created without dynamic EMF support by default. See `createNavigationHelper(Notifier, boolean, boolean, Logger)` for more options.

      Parameters:
        `emfRoot` - the root of the EMF tree to be indexed. Recommended: Resource or ResourceSet. Can be null - you can add a root later using `NavigationHelper.addRoot(Notifier)`
        `wildcardMode` - true if all aspects of the EMF model should be indexed automatically, false if manual registration of interesting aspects is desirable
        `logger` - the log output where errors will be logged if encountered during the operation of the NavigationHelper; if null, the default logger for `NavigationHelper` is used.
      Returns:
        the NavigationHelper instance
      Throws:
        `ViatraQueryRuntimeException`
      See Also:
        `NavigationHelper`

    - #### createNavigationHelper

          public NavigationHelper createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot,
                                                         boolean wildcardMode,
                                                         boolean dynamicModel,
                                                         org.apache.log4j.Logger logger)

      The method creates a `NavigationHelper` index for the given EMF model root. A new instance will be created on every call.

      A NavigationHelper in wildcard mode will process and index all EStructuralFeatures, EClasses and EDatatypes. If wildcard mode is off, the client will have to manually register the interesting aspects of the model.

      If the dynamic model flag is set to true, the index will use String ids to distinguish between the various `EStructuralFeature`, `EClass` and `EDataType` instances. This way the index is able to handle dynamic EMF instance models too.

      Parameters:
        `emfRoot` - the root of the EMF tree to be indexed. Recommended: Resource or ResourceSet. Can be null - you can add a root later using `NavigationHelper.addRoot(Notifier)`
        `wildcardMode` - true if all aspects of the EMF model should be indexed automatically, false if manual registration of interesting aspects is desirable
        `dynamicModel` - true if the index should use String ids (nsURIs) for the various EMF types and features, and treat multiple EPackages sharing an nsURI as the same. false if dynamic model support is not required
        `logger` - the log output where errors will be logged if encountered during the operation of the NavigationHelper; if null, the default logger for `NavigationHelper` is used.
      Returns:
        the NavigationHelper instance
      Throws:
        `ViatraQueryRuntimeException`
      See Also:
        `NavigationHelper`

    - #### createNavigationHelper

          public NavigationHelper createNavigationHelper(org.eclipse.emf.common.notify.Notifier emfRoot,
                                                         BaseIndexOptions options,
                                                         org.apache.log4j.Logger logger)

      The method creates a `NavigationHelper` index for the given EMF model root. A new instance will be created on every call.

      For details of base index options including wildcard and dynamic EMF mode, see `BaseIndexOptions`.

      Parameters:
        `emfRoot` - the root of the EMF tree to be indexed. Recommended: Resource or ResourceSet. Can be null - you can add a root later using `NavigationHelper.addRoot(Notifier)`
        `options` - the options used by the index
        `logger` - the log output where errors will be logged if encountered during the operation of the NavigationHelper; if null, the default logger for `NavigationHelper` is used.
      Returns:
        the NavigationHelper instance
      Throws:
        `ViatraQueryRuntimeException`
      See Also:
        `NavigationHelper`

    - #### createTransitiveClosureHelper

          public TransitiveClosureHelper createTransitiveClosureHelper(org.eclipse.emf.common.notify.Notifier emfRoot,
                                                                       java.util.Set<org.eclipse.emf.ecore.EReference> referencesToObserve)

      The method creates a TransitiveClosureHelper instance for the given EMF model root. A new instance will be created on every call.

      One must specify the set of EReferences that will be considered as edges. The set can contain multiple elements; this way one can query forward and backward reachability information along heterogenous paths.

      Parameters:
        `emfRoot` - the root of the EMF tree to be processed. Recommended: Resource or ResourceSet.
        `referencesToObserve` - the set of references to observe
      Returns:
        the TransitiveClosureHelper instance
      Throws:
        `ViatraQueryRuntimeException` - if the creation of the internal NavigationHelper failed

    - #### createTransitiveClosureHelper

          public TransitiveClosureHelper createTransitiveClosureHelper(NavigationHelper baseIndex,
                                                                       java.util.Set<org.eclipse.emf.ecore.EReference> referencesToObserve)

      The method creates a TransitiveClosureHelper instance built on an existing NavigationHelper. A new instance will be created on every call.

      One must specify the set of EReferences that will be considered as edges. The set can contain multiple elements; this way one can query forward and backward reachability information along heterogenous paths.

      Parameters:
        `baseIndex` - the already existing NavigationHelper index on the model
        `referencesToObserve` - the set of references to observe
      Returns:
        the TransitiveClosureHelper instance