Package org.eclipse.m2m.atl.emftvm.impl

## Class RuleImpl.UniqueState

- java.lang.Object
- - org.eclipse.m2m.atl.emftvm.impl.RuleImpl.UniqueState

Direct Known Subclasses:
  `RuleImpl.UniqueOffState`, `RuleImpl.UniqueOnState`

Enclosing class:
  RuleImpl

    protected abstract class RuleImpl.UniqueState
    extends java.lang.Object

Base class for code that depends on the state of `Rule.isUnique()`.

### Constructor Summary

Constructors
`protected` `UniqueState()`

### Method Summary

All Methods Instance Methods Abstract Methods Concrete Methods
`java.lang.Object` `applyOne​(StackFrame frame, TraceLink trace)` Applies `#getRule()` to `trace`
`abstract void` `checkAndCreateUniqueMapping​(TracedRule tr, org.eclipse.emf.common.util.EList<SourceElement> ses)` Checks for existence and creates a unique trace mapping entry for the source values in `ses`, if applicable.
`abstract void` `createUniqueMapping​(TraceLink trace)` Creates a unique trace mapping entry for the source values in `trace`, if applicable.
`TraceLink` `getUniqueTrace​(StackFrame frame, java.lang.Object[] values)` Returns the unique rule application trace for `values`, if applicable.
`abstract boolean` `matchFor​(StackFrame frame, java.lang.Object[] values)` Matches this rule against `values`, and records a match in `ExecEnv.getMatches()` in case of a match.
`abstract boolean` `matchFor​(StackFrame frame, java.util.Map<java.lang.String,​java.lang.Object> valuesMap, java.lang.Object[] values)` Matches this rule against `values`, and records a match in `ExecEnv.getMatches()` in case of a match.

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

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

### Constructor Detail

#### UniqueState

    protected UniqueState()

### Method Detail

#### createUniqueMapping

    public abstract void createUniqueMapping​(TraceLink trace)

Creates a unique trace mapping entry for the source values in `trace`, if applicable.

Parameters:
  `trace` - the trace element with source values

#### checkAndCreateUniqueMapping

    public abstract void checkAndCreateUniqueMapping​(TracedRule tr,
                                                     org.eclipse.emf.common.util.EList<SourceElement> ses)

Checks for existence and creates a unique trace mapping entry for the source values in `ses`, if applicable.

Parameters:
  `tr` - the traced rule to add the unique traces to
  `ses` - the source values that serve as a the unique trace key

#### matchFor

    public abstract boolean matchFor​(StackFrame frame,
                                     java.lang.Object[] values)

Matches this rule against `values`, and records a match in `ExecEnv.getMatches()` in case of a match. In case of a unique rule, this method will not match if the rule has already matched against `values` before.

Parameters:
  `frame` - the stack frame context
  `values` - the source values to match against
Returns:
  `true` iff this rule matches against `values`

#### matchFor

    public abstract boolean matchFor​(StackFrame frame,
                                     java.util.Map<java.lang.String,​java.lang.Object> valuesMap,
                                     java.lang.Object[] values)

Matches this rule against `values`, and records a match in `ExecEnv.getMatches()` in case of a match. In case of a unique rule, this method will not match if the rule has already matched against `values` before.

Parameters:
  `frame` - the stack frame context
  `valuesMap` - the map of all values, including super-rule elements
  `values` - the source values to match against
Returns:
  `true` iff this rule matches against `values`

#### getUniqueTrace

    public TraceLink getUniqueTrace​(StackFrame frame,
                                    java.lang.Object[] values)

Returns the unique rule application trace for `values`, if applicable.

Parameters:
  `frame` - the stack frame context
  `values` - the source values for the trace
Returns:
  the unique rule application trace, or `null`

#### applyOne

    public java.lang.Object applyOne​(StackFrame frame,
                                     TraceLink trace)

Applies `#getRule()` to `trace`

Parameters:
  `frame` - the stack frame in which to execute the applier and post-apply
  `trace` - the trace link with values to which to apply the rule
Returns:
  the rule application result