public class BehaviorContextMatcher extends BaseMatcher<BehaviorContextMatch>
Use the pattern matcher on a given model via on(ViatraQueryEngine)
,
e.g. in conjunction with ViatraQueryEngine#on(Notifier)
.
Matches of the pattern will be represented as BehaviorContextMatch
.
Original source:
A Behavior that is directly owned as a nestedClassifier does not have a context.
Otherwise, to determine the context of a Behavior, find the first
BehavioredClassifier reached by following the chain of owner relationships
from the Behavior, if any. If there is such a BehavioredClassifier, then it
is the context, unless it is itself a Behavior with a non-empty context, in
which case that is also the context for the original Behavior.
(if nestingClass < > null then
null
else
let b:BehavioredClassifier = self.behavioredClassifier(self.owner) in
if b.oclIsKindOf(Behavior) and b.oclAsType(Behavior)._'context' < > null then
b.oclAsType(Behavior)._'context'
else
b
endif
endif
)
// Can't compile OCL to VIATRA Query because of org.eclipse.ocl.SemanticException: Unrecognized variable: (nestingClass)
@Surrogate(feature = "context")
@QueryExplorer(checked = false)
pattern behaviorContext(source: Behavior, target: BehavioredClassifier) {
find internalBehaviorContext+(source, target);
neg find internalBehaviorContext(target, _);
}
BehaviorContextMatch
,
BehaviorContextProcessor
,
BehaviorContextQuerySpecification
engine, querySpecification
Modifier and Type | Method and Description |
---|---|
protected BehaviorContextMatch |
arrayToMatch(java.lang.Object[] match)
Converts the array representation of a pattern match to an immutable Match object.
|
protected BehaviorContextMatch |
arrayToMatchMutable(java.lang.Object[] match)
Converts the array representation of a pattern match to a mutable Match object.
|
int |
countMatches(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
static BehaviorContextMatcher |
create() |
void |
forEachMatch(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget,
IMatchProcessor<? super BehaviorContextMatch> processor)
Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
forOneArbitraryMatch(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget,
IMatchProcessor<? super BehaviorContextMatch> processor)
Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
java.util.Collection<BehaviorContextMatch> |
getAllMatches(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
|
java.util.Set<org.eclipse.uml2.uml.Behavior> |
getAllValuesOfsource()
Retrieve the set of values that occur in matches for source.
|
java.util.Set<org.eclipse.uml2.uml.Behavior> |
getAllValuesOfsource(BehaviorContextMatch partialMatch)
Retrieve the set of values that occur in matches for source.
|
java.util.Set<org.eclipse.uml2.uml.Behavior> |
getAllValuesOfsource(org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Retrieve the set of values that occur in matches for source.
|
java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> |
getAllValuesOftarget()
Retrieve the set of values that occur in matches for target.
|
java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> |
getAllValuesOftarget(org.eclipse.uml2.uml.Behavior pSource)
Retrieve the set of values that occur in matches for target.
|
java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> |
getAllValuesOftarget(BehaviorContextMatch partialMatch)
Retrieve the set of values that occur in matches for target.
|
BehaviorContextMatch |
getOneArbitraryMatch(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
hasMatch(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
under any possible substitution of the unspecified parameters (if any).
|
BehaviorContextMatch |
newMatch(org.eclipse.uml2.uml.Behavior pSource,
org.eclipse.uml2.uml.BehavioredClassifier pTarget)
Returns a new (partial) match.
|
static BehaviorContextMatcher |
on(ViatraQueryEngine engine)
Initializes the pattern matcher within an existing VIATRA Query engine.
|
static IQuerySpecification<BehaviorContextMatcher> |
querySpecification() |
protected java.util.Set<org.eclipse.uml2.uml.Behavior> |
rawAccumulateAllValuesOfsource(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for source.
|
protected java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> |
rawAccumulateAllValuesOftarget(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for target.
|
protected BehaviorContextMatch |
tupleToMatch(Tuple t) |
countMatches, countMatches, emptyArray, forEachMatch, forEachMatch, forOneArbitraryMatch, forOneArbitraryMatch, getAllMatches, getAllMatches, getAllValues, getAllValues, getCapabilities, getEngine, getOneArbitraryMatch, getOneArbitraryMatch, getParameterNames, getPatternName, getPositionOfParameter, getSpecification, hasMatch, matchToArray, newEmptyMatch, newMatch, rawAccumulateAllValues, rawCountMatches, rawForEachMatch, rawForOneArbitraryMatch, rawGetAllMatches, rawGetAllValues, rawGetOneArbitraryMatch, rawHasMatch, setBackend
public static BehaviorContextMatcher on(ViatraQueryEngine engine) throws ViatraQueryException
engine
- the existing VIATRA Query engine in which this matcher will be created.ViatraQueryException
- if an error occurs during pattern matcher creationpublic static BehaviorContextMatcher create() throws ViatraQueryException
ViatraQueryException
- if an error occurs during pattern matcher creationpublic java.util.Collection<BehaviorContextMatch> getAllMatches(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.public BehaviorContextMatch getOneArbitraryMatch(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.public boolean hasMatch(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.public int countMatches(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.public void forEachMatch(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget, IMatchProcessor<? super BehaviorContextMatch> processor)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.processor
- the action that will process each pattern match.public boolean forOneArbitraryMatch(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget, IMatchProcessor<? super BehaviorContextMatch> processor)
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.processor
- the action that will process the selected match.public BehaviorContextMatch newMatch(org.eclipse.uml2.uml.Behavior pSource, org.eclipse.uml2.uml.BehavioredClassifier pTarget)
The returned match will be immutable. Use BaseMatcher.newEmptyMatch()
to obtain a mutable match object.
pSource
- the fixed value of pattern parameter source, or null if not bound.pTarget
- the fixed value of pattern parameter target, or null if not bound.protected java.util.Set<org.eclipse.uml2.uml.Behavior> rawAccumulateAllValuesOfsource(java.lang.Object[] parameters)
public java.util.Set<org.eclipse.uml2.uml.Behavior> getAllValuesOfsource()
public java.util.Set<org.eclipse.uml2.uml.Behavior> getAllValuesOfsource(BehaviorContextMatch partialMatch)
public java.util.Set<org.eclipse.uml2.uml.Behavior> getAllValuesOfsource(org.eclipse.uml2.uml.BehavioredClassifier pTarget)
protected java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> rawAccumulateAllValuesOftarget(java.lang.Object[] parameters)
public java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> getAllValuesOftarget()
public java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> getAllValuesOftarget(BehaviorContextMatch partialMatch)
public java.util.Set<org.eclipse.uml2.uml.BehavioredClassifier> getAllValuesOftarget(org.eclipse.uml2.uml.Behavior pSource)
protected BehaviorContextMatch tupleToMatch(Tuple t)
tupleToMatch
in class BaseMatcher<BehaviorContextMatch>
protected BehaviorContextMatch arrayToMatch(java.lang.Object[] match)
BaseMatcher
arrayToMatch
in class BaseMatcher<BehaviorContextMatch>
protected BehaviorContextMatch arrayToMatchMutable(java.lang.Object[] match)
BaseMatcher
arrayToMatchMutable
in class BaseMatcher<BehaviorContextMatch>
public static IQuerySpecification<BehaviorContextMatcher> querySpecification() throws ViatraQueryException
ViatraQueryException
- if the pattern definition could not be loaded