org.eclipse.viatra.query.patternlanguage.emf.validation

## Class PatternLanguageValidator

- java.lang.Object
- - org.eclipse.xtext.validation.AbstractInjectableValidator
  - - org.eclipse.xtext.validation.AbstractDeclarativeValidator
    - - org.eclipse.viatra.query.patternlanguage.emf.validation.PatternLanguageValidator

- All Implemented Interfaces:
    org.eclipse.emf.ecore.EValidator, IIssueCallback, org.eclipse.xtext.validation.ValidationMessageAcceptor

      public class PatternLanguageValidator
      extends org.eclipse.xtext.validation.AbstractDeclarativeValidator
      implements IIssueCallback

  Validators for Core Pattern Language.

  Validators implemented:

  - Duplicate parameter in pattern declaration
  - Duplicate pattern definition (name duplication only, better calculation is needed)
  - Pattern call parameter checking (only the number of the parameters, types not supported yet)
  - Empty PatternBody check
  - Check for recursive pattern calls
  Since:
    2.0

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `org.eclipse.xtext.validation.AbstractDeclarativeValidator.MethodWrapper, org.eclipse.xtext.validation.AbstractDeclarativeValidator.State, org.eclipse.xtext.validation.AbstractDeclarativeValidator.StateAccess`

    - ### Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.EValidator

      `org.eclipse.emf.ecore.EValidator.Descriptor, org.eclipse.emf.ecore.EValidator.PatternMatcher, org.eclipse.emf.ecore.EValidator.Registry, org.eclipse.emf.ecore.EValidator.SubstitutionLabelProvider, org.eclipse.emf.ecore.EValidator.ValidationDelegate`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `ANNOTATION_PARAMETER_TYPE_ERROR`
    `static java.lang.String` | `CONFLICTING_SPECIFICATION_NAME_MESSAGE`
    `static java.lang.String` | `DUPLICATE_PATTERN_DEFINITION_MESSAGE`
    `static java.lang.String` | `DUPLICATE_VARIABLE_MESSAGE`
    `static java.lang.String` | `EXACTLY_ONE_AGGREGATE_MESSAGE`
    `static java.lang.String` | `INVALID_AGGREGATE_MESSAGE`
    `static java.lang.String` | `MISSING_AGGREGATE_MESSAGE`
    `static java.lang.String` | `MISSING_ANNOTATION_ATTRIBUTE`
    `static java.lang.String` | `RECURSIVE_PATTERN_CALL`
    `static java.lang.String` | `RECURSIVE_PATTERN_CALL_NEGATIVE`
    `static java.lang.String` | `RECURSIVE_PATTERN_CALL_TRANSITIVE`
    `static java.lang.String` | `TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL`
    `static java.lang.String` | `TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION`
    `static java.lang.String` | `UNEXPECTED_AGGREGATE_MESSAGE`
    `static java.lang.String` | `UNKNOWN_ANNOTATION_ATTRIBUTE`
    `static java.lang.String` | `VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE`
    `static java.lang.String` | `VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE`

    - ### Fields inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `CURRENT_LANGUAGE_NAME, ISSUE_SEVERITIES`

    - ### Fields inherited from interface org.eclipse.xtext.validation.ValidationMessageAcceptor

      `INSIGNIFICANT_INDEX`

    - ### Fields inherited from interface org.eclipse.emf.ecore.EValidator

      `MARKER, RELATED_URIS_ATTRIBUTE, URI_ATTRIBUTE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PatternLanguageValidator()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `checkAggregatorCallTypes(AggregatedValue expression)` Check for mistyped aggregator expressions
    `void` | `checkAggregatorExpression(AggregatedValue expression)` Checks if an aggregator expression has the correct number (0 or 1) aggregate variables.
    `void` | `checkAnnotation(Annotation annotation)`
    `void` | `checkApplicabilityOfTransitiveClosureInPatternCall(CallableRelation call)`
    `void` | `checkCompareConstraints(CompareConstraint constraint)`
    `void` | `checkEmbeddedAggregatorLength(AggregatedValue value)`
    `void` | `checkForImpureJavaCallsInCheckConstraints(CheckConstraint checkConstraint)`
    `void` | `checkForImpureJavaCallsInEvalExpressions(FunctionEvaluationValue eval)`
    `void` | `checkNegativeCallParameters(PatternCompositionConstraint constraint)`
    `void` | `checkPackageDeclaration(PatternModel model)`
    `void` | `checkPatternBody(PatternBody body)`
    `void` | `checkPatternCallParameters(PatternCall call)`
    `void` | `checkPatternParameters(Pattern pattern)`
    `void` | `checkPatterns(PatternModel model)`
    `void` | `checkPrivatePatternCall(PatternCall call)`
    `void` | `checkRecursivePatternCall(PatternCall call)`
    `void` | `checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint)`
    `void` | `checkReturnTypeOfFunctionEvaluationValues(FunctionEvaluationValue evalValue)`
    `void` | `checkValueReference(VariableReference value)` Checks if an aggregate `VariableReference` is used only in the right context, that is, in an `AggregatedValue` with an aggregator requiring aggregator parameters.
    `void` | `checkVariableNames(PatternBody body)`
    `void` | `enableQueryGroupGeneration(boolean queryGroupGenerationEnabled)`
    `void` | `error(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)`
    `protected java.util.List<org.eclipse.emf.ecore.EPackage>` | `getEPackages()`
    `protected java.lang.String` | `getFormattedArgumentsList(java.util.List<ValueReference> arguments)`
    `void` | `register(org.eclipse.xtext.validation.EValidatorRegistrar reg)`
    `void` | `warning(java.lang.String message, org.eclipse.emf.ecore.EObject source, org.eclipse.emf.ecore.EStructuralFeature feature, java.lang.String code, java.lang.String... issueData)`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractDeclarativeValidator

      `acceptError, acceptError, acceptInfo, acceptInfo, acceptWarning, acceptWarning, addIssue, addIssue, addIssue, addIssue, addIssue, addIssueToState, checkDone, checkIsFromCurrentlyCheckedResource, createDiagnostic, createDiagnostic, createMethodWrapper, error, error, error, error, error, error, error, getChain, getCheckMode, getContext, getCurrentMethod, getCurrentObject, getIssueSeverities, getMessageAcceptor, guard, handleExceptionDuringValidation, info, info, info, info, info, info, info, info, internalValidate, isIgnored, newInstance, setInjector, setMessageAcceptor, toDiagnosticSeverity, warning, warning, warning, warning, warning, warning, warning`

    - ### Methods inherited from class org.eclipse.xtext.validation.AbstractInjectableValidator

      `getCurrentLanguage, isLanguageSpecific, isResponsible, validate, validate, validate`

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

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

- - ### Field Detail

    - #### DUPLICATE_VARIABLE_MESSAGE

          public static final java.lang.String DUPLICATE_VARIABLE_MESSAGE

      See Also:
        Constant Field Values

    - #### DUPLICATE_PATTERN_DEFINITION_MESSAGE

          public static final java.lang.String DUPLICATE_PATTERN_DEFINITION_MESSAGE

      See Also:
        Constant Field Values

    - #### CONFLICTING_SPECIFICATION_NAME_MESSAGE

          public static final java.lang.String CONFLICTING_SPECIFICATION_NAME_MESSAGE

      Since:
        1.7
      See Also:
        Constant Field Values

    - #### UNKNOWN_ANNOTATION_ATTRIBUTE

          public static final java.lang.String UNKNOWN_ANNOTATION_ATTRIBUTE

      See Also:
        Constant Field Values

    - #### MISSING_ANNOTATION_ATTRIBUTE

          public static final java.lang.String MISSING_ANNOTATION_ATTRIBUTE

      See Also:
        Constant Field Values

    - #### ANNOTATION_PARAMETER_TYPE_ERROR

          public static final java.lang.String ANNOTATION_PARAMETER_TYPE_ERROR

      See Also:
        Constant Field Values

    - #### TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL

          public static final java.lang.String TRANSITIVE_CLOSURE_ARITY_IN_PATTERNCALL

      See Also:
        Constant Field Values

    - #### TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION

          public static final java.lang.String TRANSITIVE_CLOSURE_ONLY_IN_POSITIVE_COMPOSITION

      See Also:
        Constant Field Values

    - #### RECURSIVE_PATTERN_CALL

          public static final java.lang.String RECURSIVE_PATTERN_CALL

      See Also:
        Constant Field Values

    - #### RECURSIVE_PATTERN_CALL_TRANSITIVE

          public static final java.lang.String RECURSIVE_PATTERN_CALL_TRANSITIVE

      Since:
        2.0
      See Also:
        Constant Field Values

    - #### RECURSIVE_PATTERN_CALL_NEGATIVE

          public static final java.lang.String RECURSIVE_PATTERN_CALL_NEGATIVE

      Since:
        2.0
      See Also:
        Constant Field Values

    - #### INVALID_AGGREGATE_MESSAGE

          public static final java.lang.String INVALID_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### UNEXPECTED_AGGREGATE_MESSAGE

          public static final java.lang.String UNEXPECTED_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### EXACTLY_ONE_AGGREGATE_MESSAGE

          public static final java.lang.String EXACTLY_ONE_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### MISSING_AGGREGATE_MESSAGE

          public static final java.lang.String MISSING_AGGREGATE_MESSAGE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE

          public static final java.lang.String VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_SINGLEUSE

      Since:
        1.4
      See Also:
        Constant Field Values

    - #### VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE

          public static final java.lang.String VARIABLE_NAME_DUBIUS_REUSE_MESSAGE_AGGREGATE

      Since:
        1.4
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### PatternLanguageValidator

          public PatternLanguageValidator()

  - ### Method Detail

    - #### enableQueryGroupGeneration

          @Inject
          public void enableQueryGroupGeneration(boolean queryGroupGenerationEnabled)

      Since:
        2.3

    - #### register

          public void register(org.eclipse.xtext.validation.EValidatorRegistrar reg)

      Overrides:
        `register` in class `org.eclipse.xtext.validation.AbstractInjectableValidator`

    - #### getEPackages

          protected java.util.List<org.eclipse.emf.ecore.EPackage> getEPackages()

      Overrides:
        `getEPackages` in class `org.eclipse.xtext.validation.AbstractInjectableValidator`

    - #### checkValueReference

          public void checkValueReference(VariableReference value)

      Checks if an aggregate `VariableReference` is used only in the right context, that is, in an `AggregatedValue` with an aggregator requiring aggregator parameters.
      Parameters:
        `value` - the `VariableReference` instance
      Since:
        1.4

    - #### checkAggregatorExpression

          public void checkAggregatorExpression(AggregatedValue expression)

      Checks if an aggregator expression has the correct number (0 or 1) aggregate variables.
      Parameters:
        `expression` - the aggregator expression
      Since:
        1.4

    - #### checkAggregatorCallTypes

          public void checkAggregatorCallTypes(AggregatedValue expression)

      Check for mistyped aggregator expressions
      Since:
        1.7

    - #### checkEmbeddedAggregatorLength

          public void checkEmbeddedAggregatorLength(AggregatedValue value)

    - #### checkPatternParameters

          public void checkPatternParameters(Pattern pattern)

    - #### checkPrivatePatternCall

          public void checkPrivatePatternCall(PatternCall call)

    - #### checkPatternCallParameters

          public void checkPatternCallParameters(PatternCall call)

    - #### checkApplicabilityOfTransitiveClosureInPatternCall

          public void checkApplicabilityOfTransitiveClosureInPatternCall(CallableRelation call)

    - #### checkPatterns

          public void checkPatterns(PatternModel model)

    - #### checkPatternBody

          public void checkPatternBody(PatternBody body)

    - #### checkAnnotation

          public void checkAnnotation(Annotation annotation)

    - #### checkCompareConstraints

          public void checkCompareConstraints(CompareConstraint constraint)

    - #### checkRecursivePatternCall

          public void checkRecursivePatternCall(PatternCall call)

    - #### getFormattedArgumentsList

          protected java.lang.String getFormattedArgumentsList(java.util.List<ValueReference> arguments)

    - #### checkPackageDeclaration

          public void checkPackageDeclaration(PatternModel model)

    - #### checkReturnTypeOfCheckConstraints

          public void checkReturnTypeOfCheckConstraints(CheckConstraint checkConstraint)

    - #### checkReturnTypeOfFunctionEvaluationValues

          public void checkReturnTypeOfFunctionEvaluationValues(FunctionEvaluationValue evalValue)

      Since:
        2.7

    - #### checkVariableNames

          public void checkVariableNames(PatternBody body)

    - #### checkForImpureJavaCallsInCheckConstraints

          public void checkForImpureJavaCallsInCheckConstraints(CheckConstraint checkConstraint)

    - #### checkForImpureJavaCallsInEvalExpressions

          public void checkForImpureJavaCallsInEvalExpressions(FunctionEvaluationValue eval)

    - #### checkNegativeCallParameters

          public void checkNegativeCallParameters(PatternCompositionConstraint constraint)

    - #### warning

          public void warning(java.lang.String message,
                              org.eclipse.emf.ecore.EObject source,
                              org.eclipse.emf.ecore.EStructuralFeature feature,
                              java.lang.String code,
                              java.lang.String... issueData)

      Specified by:
        `warning` in interface `IIssueCallback`
      Overrides:
        `warning` in class `org.eclipse.xtext.validation.AbstractDeclarativeValidator`

    - #### error

          public void error(java.lang.String message,
                            org.eclipse.emf.ecore.EObject source,
                            org.eclipse.emf.ecore.EStructuralFeature feature,
                            java.lang.String code,
                            java.lang.String... issueData)

      Specified by:
        `error` in interface `IIssueCallback`
      Overrides:
        `error` in class `org.eclipse.xtext.validation.AbstractDeclarativeValidator`