Package org.eclipse.viatra.query.runtime.api.impl

## Class BaseQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>

- java.lang.Object
- - org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<Matcher>

- All Implemented Interfaces:
    `IQuerySpecification<Matcher>`, `PQueryHeader`
  Direct Known Subclasses:
    `BaseGeneratedEMFQuerySpecification`, `GenericQuerySpecification`

      public abstract class BaseQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>
      extends java.lang.Object
      implements IQuerySpecification<Matcher>

  Base implementation of IQuerySpecification.

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected PQuery` | `wrappedPQuery` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BaseQuerySpecification​(PQuery wrappedPQuery)` | Instantiates query specification for the given internal query representation.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected void` | `ensureInitializedInternal()` |
    `java.util.List<PAnnotation>` | `getAllAnnotations()` | Returns the list of annotations specified for this query
    `java.util.List<PAnnotation>` | `getAnnotationsByName​(java.lang.String annotationName)` | Returns the list of annotations with a specified name
    `java.util.Optional<PAnnotation>` | `getFirstAnnotationByName​(java.lang.String annotationName)` | Returns the first annotation with a specified name
    `java.lang.String` | `getFullyQualifiedName()` | Identifies the pattern for which matchers can be instantiated.
    `PQuery` | `getInternalQueryRepresentation()` | Returns the definition of the query in a format intended for consumption by the query evaluator.
    `Matcher` | `getMatcher​(ViatraQueryEngine engine)` | Initializes the pattern matcher within an existing `ViatraQueryEngine`.
    `java.util.List<java.lang.String>` | `getParameterNames()` | Return the list of parameter names
    `java.util.List<PParameter>` | `getParameters()` | Returns a list of parameter descriptions
    `java.lang.Integer` | `getPositionOfParameter​(java.lang.String parameterName)` | Returns the index of a named parameter
    `PVisibility` | `getVisibility()` | Returns the visibility information about the query.
    `Matcher` | `instantiate()` | For backward compatibility of code generated with previous versions of viatra query, this method has a default implementation returning null, indicating that a matcher can only be created using the old method, which ignores the hints provided by the user.
    `protected abstract Matcher` | `instantiate​(ViatraQueryEngine engine)` |
    `protected static ViatraQueryException` | `processInitializerError​(java.lang.ExceptionInInitializerError err)` |

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

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

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.api.IQuerySpecification

      `getPProblems, getPreferredScopeClass, getStatus, newEmptyMatch, newMatch`

    - ### Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader

      `getParameter, getSimpleName`

- - ### Field Detail

    - #### wrappedPQuery

          protected final PQuery wrappedPQuery

  - ### Constructor Detail

    - #### BaseQuerySpecification

          public BaseQuerySpecification​(PQuery wrappedPQuery)

      Instantiates query specification for the given internal query representation.

  - ### Method Detail

    - #### processInitializerError

          protected static ViatraQueryException processInitializerError​(java.lang.ExceptionInInitializerError err)

      Since:
        1.6

    - #### instantiate

          protected abstract Matcher instantiate​(ViatraQueryEngine engine)

    - #### instantiate

          public Matcher instantiate()

      For backward compatibility of code generated with previous versions of viatra query, this method has a default implementation returning null, indicating that a matcher can only be created using the old method, which ignores the hints provided by the user.
      Specified by:
        `instantiate` in interface `IQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>`
      Since:
        1.4

    - #### getInternalQueryRepresentation

          public PQuery getInternalQueryRepresentation()

      Description copied from interface: `IQuerySpecification`
      Returns the definition of the query in a format intended for consumption by the query evaluator.
      Specified by:
        `getInternalQueryRepresentation` in interface `IQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>`
      Returns:
        the internal representation of the query.

    - #### getMatcher

          public Matcher getMatcher​(ViatraQueryEngine engine)

      Description copied from interface: `IQuerySpecification`
      Initializes the pattern matcher within an existing `ViatraQueryEngine`. If the pattern matcher is already constructed in the engine, only a lightweight reference is created.

      The match set will be incrementally refreshed upon updates.

      Specified by:
        `getMatcher` in interface `IQuerySpecification<Matcher extends ViatraQueryMatcher<? extends IPatternMatch>>`
      Parameters:
        `engine` - the existing VIATRA Query engine in which this matcher will be created.

    - #### ensureInitializedInternal

          protected void ensureInitializedInternal()

    - #### getAllAnnotations

          public java.util.List<PAnnotation> getAllAnnotations()

      Description copied from interface: `PQueryHeader`
      Returns the list of annotations specified for this query
      Specified by:
        `getAllAnnotations` in interface `PQueryHeader`
      Returns:
        a non-null, but possibly empty list of annotations

    - #### getAnnotationsByName

          public java.util.List<PAnnotation> getAnnotationsByName​(java.lang.String annotationName)

      Description copied from interface: `PQueryHeader`
      Returns the list of annotations with a specified name
      Specified by:
        `getAnnotationsByName` in interface `PQueryHeader`
      Returns:
        a non-null, but possibly empty list of annotations

    - #### getFirstAnnotationByName

          public java.util.Optional<PAnnotation> getFirstAnnotationByName​(java.lang.String annotationName)

      Description copied from interface: `PQueryHeader`
      Returns the first annotation with a specified name
      Specified by:
        `getFirstAnnotationByName` in interface `PQueryHeader`

    - #### getFullyQualifiedName

          public java.lang.String getFullyQualifiedName()

      Description copied from interface: `PQueryHeader`
      Identifies the pattern for which matchers can be instantiated.
      Specified by:
        `getFullyQualifiedName` in interface `PQueryHeader`

    - #### getParameterNames

          public java.util.List<java.lang.String> getParameterNames()

      Description copied from interface: `PQueryHeader`
      Return the list of parameter names
      Specified by:
        `getParameterNames` in interface `PQueryHeader`
      Returns:
        a non-null, but possibly empty list of parameter names

    - #### getParameters

          public java.util.List<PParameter> getParameters()

      Description copied from interface: `PQueryHeader`
      Returns a list of parameter descriptions
      Specified by:
        `getParameters` in interface `PQueryHeader`
      Returns:
        a non-null, but possibly empty list of parameter descriptions

    - #### getPositionOfParameter

          public java.lang.Integer getPositionOfParameter​(java.lang.String parameterName)

      Description copied from interface: `PQueryHeader`
      Returns the index of a named parameter
      Specified by:
        `getPositionOfParameter` in interface `PQueryHeader`
      Returns:
        the index, or null of no such parameter is available

    - #### getVisibility

          public PVisibility getVisibility()

      Description copied from interface: `PQueryHeader`
      Returns the visibility information about the query.
      Specified by:
        `getVisibility` in interface `PQueryHeader`
      Since:
        2.0