org.eclipse.incquery.runtime.api.impl

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

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

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

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

  Base implementation of IQuerySpecification.
  Author:
    Gabor Bergmann

- - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `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
    `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(IncQueryEngine engine)` Initializes the pattern matcher within an existing `IncQueryEngine`.
    `Matcher` | `getMatcher(org.eclipse.emf.common.notify.Notifier emfRoot)` Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet).
    `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

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

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

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

      `getPreferredScopeClass, newEmptyMatch, newMatch`

- - ### Constructor Detail

    - #### BaseQuerySpecification

          public BaseQuerySpecification(PQuery wrappedPQuery)

      Instantiates query specification for the given internal query representation.

  - ### Method Detail

    - #### 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 IncQueryMatcher<? extends IPatternMatch>>`
      Returns:
        the internal representation of the query.

    - #### getMatcher

          public Matcher getMatcher(org.eclipse.emf.common.notify.Notifier emfRoot)
                             throws IncQueryException

      Description copied from interface: `IQuerySpecification`
      Initializes the pattern matcher over a given EMF model root (recommended: Resource or ResourceSet). If a pattern matcher is already constructed with the same root, only a lightweight reference is created.

      The scope of pattern matching will be the given EMF model root and below (see FAQ for more precise definition).

      The match set will be incrementally refreshed upon updates from this scope.

      The matcher will be created within the managed `IncQueryEngine` belonging to the EMF model root, so multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.

      Specified by:
        `getMatcher` in interface `IQuerySpecification<Matcher extends IncQueryMatcher<? extends IPatternMatch>>`
      Parameters:
        `emfRoot` - the root of the EMF tree where the pattern matcher will operate. Recommended: Resource or ResourceSet.
      Throws:
        `IncQueryException` - if an error occurs during pattern matcher creation

    - #### getMatcher

          public Matcher getMatcher(IncQueryEngine engine)
                             throws IncQueryException

      Description copied from interface: `IQuerySpecification`
      Initializes the pattern matcher within an existing `IncQueryEngine`. 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 IncQueryMatcher<? extends IPatternMatch>>`
      Parameters:
        `engine` - the existing IncQuery engine in which this matcher will be created.
      Throws:
        `IncQueryException` - if an error occurs during pattern matcher creation

    - #### 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 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`
      Returns:
        the found annotation, or null if non is available

    - #### 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