org.eclipse.incquery.runtime.api

## Interface IPatternMatch

- All Superinterfaces:
    java.lang.Cloneable
  All Known Implementing Classes:
    ActionContextMatch, ActionInputMatch, ActionOutputMatch, ActivityEdgeInGroupMatch, ActivityGroupContainedEdgeMatch, ActivityGroupContainedNodeMatch, ActivityGroupInActivityMatch, ActivityGroupMatch, ActivityGroupSubgroupMatch, ActivityGroupSuperGroupMatch, ActivityNodeActivityMatch, ActivityNodeInGroupMatch, ActivityNodeMatch, AssociationEndTypeMatch, BasePatternMatch, BehaviorContextMatch, ChildrenMatch, ClassExtensionMatch, ClassifierAllParentsMatch, ClassifierAttributeMatch, ClassifierFeatureMatch, ClassifierGeneralMatch, ClassifierParentsMatch, ClassSuperClassMatch, ConnectableElementEndMatch, ConnectorKindMatch, DeploymentTargetDeployedElementMatch, DirectedRelationshipSourceMatch, DirectedRelationshipTargetMatch, ElementOwnedElementMatch, ElementOwnerMatch, EmptyTraceMatch, EncapsulatedClassifierOwnedPortMatch, ExtensionMetaclassEndMatch, ExtensionMetaclassMatch, FeatureFeaturingClassifierMatch, GenericPatternMatch, MessageMessageKindMatch, NamedElementClientDependencyMatch, NamedElementNamespaceMatch, NamedElementQualifiedNameMatch, NamespaceImportedMemberMatch, NamespaceMemberMatch, NamespaceOwnedMemberMatch, OpaqueExpressionResultMatch, OperationReturnResultMatch, PackageNestedPackageMatch, PackageNestingPackageMatch, PackageOwnedStereotypeMatch, PackageOwnedTypeMatch, PackageVisibleMemberMatch, Param2containmentMatch, Param2edgeMatch, Param2itemMatch, Param2targetMatch, PropertyIsCompositeMatch, ProtocolTransitionReferredMatch, RedefinableElementRedefinedElementMatch, RedefinableElementRedefinitionContextMatch, RedefinableTemplateSignatureInheritedParameterMatch, RelationshipRelatedElementMatch, StateIsCompositeMatch, StateIsOrthogonalMatch, StructuredClassifierPartMatch, StructuredClassifierRoleMatch, Trace2objectMatch, Trace2paramMatch, Trace2targetMatch, TraceMatch, TypePackageMatch, VertexIncomingMatch, VertexOutgoingMatch

      public interface IPatternMatch
      extends java.lang.Cloneable

  Generic interface for a single match of a pattern. Each instance is a (partial) substitution of pattern parameters, essentially a parameter to value mapping.

  Can also represent a partial match; unsubstituted parameters are assigned to null. Pattern matchers must never return a partial match, but they accept partial matches as method parameters.

  Author:
    Bergmann Gábor

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.Object` | `get(int position)` Returns the value of the parameter at the given position, or null if position is invalid.
    `java.lang.Object` | `get(java.lang.String parameterName)` Returns the value of the parameter with the given name, or null if name is invalid.
    `boolean` | `isCompatibleWith(IPatternMatch other)` Checks that this match is compatible with the given other match.
    `boolean` | `isMutable()` Returns whether the match object can be further modified after its creation.
    `java.util.List<java.lang.String>` | `parameterNames()` Returns the list of symbolic parameter names.
    `java.lang.String` | `patternName()` Identifies the name of the pattern for which this is a match.
    `java.lang.String` | `prettyPrint()` Prints the list of parameter-value pairs.
    `boolean` | `set(int position, java.lang.Object newValue)` Sets the parameter at the given position to the given value.
    `boolean` | `set(java.lang.String parameterName, java.lang.Object newValue)` Sets the parameter with the given name to the given value.
    `IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>>` | `specification()`
    `java.lang.Object[]` | `toArray()` Converts the match to an array representation, with each pattern parameter at their respective position.
    `IPatternMatch` | `toImmutable()` Takes an immutable snapshot of this match.

- - ### Method Detail

    - #### specification

          IQuerySpecification<? extends IncQueryMatcher<? extends IPatternMatch>> specification()

      Returns:
        the pattern for which this is a match.

    - #### patternName

          java.lang.String patternName()

      Identifies the name of the pattern for which this is a match.

    - #### parameterNames

          java.util.List<java.lang.String> parameterNames()

      Returns the list of symbolic parameter names.

    - #### get

          java.lang.Object get(java.lang.String parameterName)

      Returns the value of the parameter with the given name, or null if name is invalid.

    - #### get

          java.lang.Object get(int position)

      Returns the value of the parameter at the given position, or null if position is invalid.

    - #### set

          boolean set(java.lang.String parameterName,
                      java.lang.Object newValue)

      Sets the parameter with the given name to the given value.

      Works only if match is mutable. See `isMutable()`.

      Throws:
        `java.lang.UnsupportedOperationException` - if match is not mutable.

    - #### set

          boolean set(int position,
                      java.lang.Object newValue)

      Sets the parameter at the given position to the given value.

      Works only if match is mutable. See `isMutable()`.

      Throws:
        `java.lang.UnsupportedOperationException` - if match is not mutable.

    - #### isMutable

          boolean isMutable()

      Returns whether the match object can be further modified after its creation. Setters work only if the match is mutable.

      Matches computed by the pattern matchers are not mutable, so that the match set cannot be modified externally. Partial matches used as matcher input, however, can be mutable; such match objects can be created using `IncQueryMatcher.newEmptyMatch()`.

      Returns:
        whether the match can be modified

    - #### toArray

          java.lang.Object[] toArray()

      Converts the match to an array representation, with each pattern parameter at their respective position. In case of a partial match, unsubstituted parameters will be represented as null elements in the array.
      Returns:
        a newly constructed array containing each parameter substitution of the match in order.

    - #### toImmutable

          IPatternMatch toImmutable()

      Takes an immutable snapshot of this match.
      Returns:
        the match itself in case of immutable matches, an immutable copy in case of mutable ones.

    - #### prettyPrint

          java.lang.String prettyPrint()

      Prints the list of parameter-value pairs.

    - #### isCompatibleWith

          boolean isCompatibleWith(IPatternMatch other)

      Checks that this match is compatible with the given other match. This is used for filtering the match set of a matcher.

      Two non-null matches are compatible if and only if:
      - They share the same pattern.
      - For each parameter, where they are set (non-null) in both matches, their values are equal.

    Furthermore, all matches are considered compatible with null matches (e.g. empty filter).

Parameters:
  `other` -
Returns:
  true, if this is compatible with other, or other is null