org.eclipse.incquery.patternlanguage.emf.specification

## Class GenericEMFPatternPQuery

- java.lang.Object
- - org.eclipse.incquery.runtime.matchers.psystem.queries.BasePQuery
  - - org.eclipse.incquery.patternlanguage.emf.specification.GenericEMFPatternPQuery

- All Implemented Interfaces:
    InitializablePQuery, PQuery, PQueryHeader

      public class GenericEMFPatternPQuery
      extends BasePQuery
      implements InitializablePQuery

  This is a generic (i.e. not pattern-specific) class for the internal representation of EMF-IncQuery queries, for "interpretative" query execution.

  End users should use {link GenericQuerySpecification} instead.

  Author:
    Bergmann Gábor

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.eclipse.incquery.runtime.matchers.psystem.queries.PQuery

      `PQuery.PQueryStatus`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `GenericEMFPatternPQuery(Pattern pattern)` Initializes a generic query representation for a given pattern.
    `GenericEMFPatternPQuery(Pattern pattern, boolean delayedInitialization)` Initializes a generic query specification for a given pattern.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addAnnotation(PAnnotation annotation)` Adds an annotation to the specification.
    `void` | `addError(PProblem problem)` Adds a detected error.
    `boolean` | `equals(java.lang.Object obj)`
    `PDisjunction` | `getDisjunctBodies()` Returns all bodies associated with the query in their canonical form.
    `java.lang.String` | `getFullyQualifiedName()` Identifies the pattern for which matchers can be instantiated.
    `java.util.List<PParameter>` | `getParameters()` Returns a list of parameter descriptions
    `Pattern` | `getPattern()`
    `int` | `hashCode()`
    `void` | `initializeBodies(java.util.Set<PBody> bodies)` Sets up the bodies stored inside this query specification.
    `void` | `setStatus(PQuery.PQueryStatus newStatus)` Sets the query status.

    - ### Methods inherited from class org.eclipse.incquery.runtime.matchers.psystem.queries.BasePQuery

      `checkMutability, ensureInitialized, ensureInitializedSneaky, getAllAnnotations, getAllReferredQueries, getAnnotationsByName, getDirectReferredQueries, getEvaluationHints, getFirstAnnotationByName, getParameterNames, getPositionOfParameter, getPProblems, getStatus, isMutable, publishedAs`

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

      `getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.incquery.runtime.matchers.psystem.queries.PQuery

      `checkMutability, ensureInitialized, getAllReferredQueries, getDirectReferredQueries, getEvaluationHints, getPProblems, getStatus, isMutable, publishedAs`

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

      `getAllAnnotations, getAnnotationsByName, getFirstAnnotationByName, getParameterNames, getPositionOfParameter`

- - ### Constructor Detail

    - #### GenericEMFPatternPQuery

          public GenericEMFPatternPQuery(Pattern pattern)
                                  throws QueryInitializationException

      Initializes a generic query representation for a given pattern.

      Warning: it is not recommended to directly instantiate GenericPQuery instances as they will not reuse previously built specifications- use `SpecificationBuilder` instead.

      Parameters:
        `pattern` - the pattern for which the matcher is to be constructed.
      Throws:
        `QueryInitializationException`

    - #### GenericEMFPatternPQuery

          public GenericEMFPatternPQuery(Pattern pattern,
                                         boolean delayedInitialization)
                                  throws QueryInitializationException

      Initializes a generic query specification for a given pattern.
      Parameters:
        `pattern` - the pattern for which matchers are to be constructed.
        `delayedInitialization` - true if the query is not created automatically - in this case before use the `initializeBodies(Set)` method
      Throws:
        `QueryInitializationException`

  - ### Method Detail

    - #### getPattern

          public Pattern getPattern()

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

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

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

    - #### getDisjunctBodies

          public PDisjunction getDisjunctBodies()

      Description copied from interface: `PQuery`
      Returns all bodies associated with the query in their canonical form. If called multiple times, the same set with the same contents will be returned.
      Specified by:
        `getDisjunctBodies` in interface `PQuery`
      Overrides:
        `getDisjunctBodies` in class `BasePQuery`

    - #### addAnnotation

          public void addAnnotation(PAnnotation annotation)

      Description copied from interface: `InitializablePQuery`
      Adds an annotation to the specification. Only applicable if the pattern is still `uninitialized`.
      Specified by:
        `addAnnotation` in interface `InitializablePQuery`

    - #### initializeBodies

          public void initializeBodies(java.util.Set<PBody> bodies)
                                throws QueryInitializationException

      Sets up the bodies stored inside this query specification. Only available for uninitialized specifications.
      Specified by:
        `initializeBodies` in interface `InitializablePQuery`
      Parameters:
        `bodies` - a non-empty set of `PBody` instances
      Throws:
        `QueryInitializationException`

    - #### setStatus

          public final void setStatus(PQuery.PQueryStatus newStatus)

      Description copied from interface: `InitializablePQuery`
      Sets the query status. Only applicable if the pattern is still `uninitialized`.
      Specified by:
        `setStatus` in interface `InitializablePQuery`
      Parameters:
        `newStatus` - the new status

    - #### addError

          public void addError(PProblem problem)

      Description copied from interface: `InitializablePQuery`
      Adds a detected error. Only applicable if the pattern is still `uninitialized`.
      Specified by:
        `addError` in interface `InitializablePQuery`
      Parameters:
        `problem` - the new problem