org.eclipse.viatra.transformation.runtime.emf.rules.batch

## Class BatchTransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>

- java.lang.Object
- - org.eclipse.viatra.transformation.runtime.emf.rules.batch.BatchTransformationRule<MATCH,MATCHER>

- All Implemented Interfaces:
    ITransformationRule<MATCH,MATCHER>

      public class BatchTransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>
      extends java.lang.Object
      implements ITransformationRule<MATCH,MATCHER>

  Wrapper class for transformation rule definition to hide EVM specific internals. Subclasses can simply override the abstract precondition and model manipulation methods.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `ruleName`
    `static ActivationLifeCycle` | `STATEFUL_RULE_LIFECYCLE` Lifecycle for a rule that stores the list of fired activations; thus effectively forbids re-firing the same activation.
    `static ActivationLifeCycle` | `STATELESS_RULE_LIFECYCLE` Lifecycle for a rule that does not store the list of fired activations; thus allows re-firing the same activation again.

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `BatchTransformationRule()`
    `` | `BatchTransformationRule(BatchTransformationRule<MATCH,MATCHER> rule, EventFilter<MATCH> filter)`
    `` | `BatchTransformationRule(java.lang.String rulename, IQuerySpecification<MATCHER> matcher, ActivationLifeCycle lifecycle, java.util.function.Consumer<MATCH> action)`
    `` | `BatchTransformationRule(java.lang.String rulename, IQuerySpecification<MATCHER> matcher, ActivationLifeCycle lifecycle, java.util.function.Consumer<MATCH> action, EventFilter<? super MATCH> filter)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.function.Consumer<MATCH>` | `getAction()` Return a `Consumer` representing the model manipulation executed by the rule.
    `EventFilter<? super MATCH>` | `getFilter()` Returns the event filter set up for this rule; if no specific filter is set up, an dedicated empty filter is returned
    `java.lang.String` | `getName()`
    `IQuerySpecification<MATCHER>` | `getPrecondition()` Returns the query specification representing the pattern used as a precondition.
    `RuleSpecification<MATCH>` | `getRuleSpecification()` Returns a RuleSpecification that can be added to a rule engine.
    `boolean` | `registerRule(RuleEngine engine)` Registers the current transformation rule over a rule engine
    `boolean` | `unregisterRule(RuleEngine engine)` Removes the current transformation rule from a rule engine

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

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

- - ### Field Detail

    - #### STATELESS_RULE_LIFECYCLE

          public static final ActivationLifeCycle STATELESS_RULE_LIFECYCLE

      Lifecycle for a rule that does not store the list of fired activations; thus allows re-firing the same activation again.

    - #### STATEFUL_RULE_LIFECYCLE

          public static final ActivationLifeCycle STATEFUL_RULE_LIFECYCLE

      Lifecycle for a rule that stores the list of fired activations; thus effectively forbids re-firing the same activation.

    - #### ruleName

          protected java.lang.String ruleName

  - ### Constructor Detail

    - #### BatchTransformationRule

          protected BatchTransformationRule()

    - #### BatchTransformationRule

          public BatchTransformationRule(java.lang.String rulename,
                                         IQuerySpecification<MATCHER> matcher,
                                         ActivationLifeCycle lifecycle,
                                         java.util.function.Consumer<MATCH> action)

      Since:
        2.0

    - #### BatchTransformationRule

          public BatchTransformationRule(java.lang.String rulename,
                                         IQuerySpecification<MATCHER> matcher,
                                         ActivationLifeCycle lifecycle,
                                         java.util.function.Consumer<MATCH> action,
                                         EventFilter<? super MATCH> filter)

      Since:
        2.0

    - #### BatchTransformationRule

          public BatchTransformationRule(BatchTransformationRule<MATCH,MATCHER> rule,
                                         EventFilter<MATCH> filter)

  - ### Method Detail

    - #### getName

          public java.lang.String getName()

      Specified by:
        `getName` in interface `ITransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>`

    - #### getRuleSpecification

          public RuleSpecification<MATCH> getRuleSpecification()

      Returns a RuleSpecification that can be added to a rule engine.
      Specified by:
        `getRuleSpecification` in interface `ITransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>`

    - #### getPrecondition

          public IQuerySpecification<MATCHER> getPrecondition()

      Returns the query specification representing the pattern used as a precondition.
      Specified by:
        `getPrecondition` in interface `ITransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>`

    - #### getAction

          public java.util.function.Consumer<MATCH> getAction()

      Return a `Consumer` representing the model manipulation executed by the rule.
      Since:
        2.0

    - #### getFilter

          public EventFilter<? super MATCH> getFilter()

      Description copied from interface: `ITransformationRule`
      Returns the event filter set up for this rule; if no specific filter is set up, an dedicated empty filter is returned
      Specified by:
        `getFilter` in interface `ITransformationRule<MATCH extends IPatternMatch,MATCHER extends ViatraQueryMatcher<MATCH>>`
      Returns:
        the event filter for this rule, never null

    - #### registerRule

          public boolean registerRule(RuleEngine engine)

      Registers the current transformation rule over a rule engine
      Since:
        2.2

    - #### unregisterRule

          public boolean unregisterRule(RuleEngine engine)

      Removes the current transformation rule from a rule engine
      Since:
        2.2