public class GeneralizationMatcher extends org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<GeneralizationMatch>
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 GeneralizationMatch
.
Original source:
Defines parent-child relation between classes
pattern generalization(general : Class, specific : Class) {
Generalization.general(generalization, general);
Generalization.specific(generalization, specific);
}
GeneralizationMatch
,
GeneralizationProcessor
,
GeneralizationQuerySpecification
Modifier and Type | Method and Description |
---|---|
protected GeneralizationMatch |
arrayToMatch(java.lang.Object[] match) |
protected GeneralizationMatch |
arrayToMatchMutable(java.lang.Object[] match) |
int |
countMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
static GeneralizationMatcher |
create() |
void |
forEachMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super GeneralizationMatch> processor)
Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
forOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super GeneralizationMatch> 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<GeneralizationMatch> |
getAllMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfgeneral()
Retrieve the set of values that occur in matches for general.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfgeneral(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Retrieve the set of values that occur in matches for general.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfgeneral(GeneralizationMatch partialMatch)
Retrieve the set of values that occur in matches for general.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfspecific()
Retrieve the set of values that occur in matches for specific.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfspecific(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral)
Retrieve the set of values that occur in matches for specific.
|
java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
getAllValuesOfspecific(GeneralizationMatch partialMatch)
Retrieve the set of values that occur in matches for specific.
|
GeneralizationMatch |
getOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
hasMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
under any possible substitution of the unspecified parameters (if any).
|
GeneralizationMatch |
newMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral,
com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
Returns a new (partial) match.
|
static GeneralizationMatcher |
on(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine)
Initializes the pattern matcher within an existing VIATRA Query engine.
|
static org.eclipse.viatra.query.runtime.api.IQuerySpecification<GeneralizationMatcher> |
querySpecification() |
protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
rawAccumulateAllValuesOfgeneral(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for general.
|
protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
rawAccumulateAllValuesOfspecific(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for specific.
|
protected GeneralizationMatch |
tupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t) |
countMatches, countMatches, emptyArray, forEachMatch, forEachMatch, forOneArbitraryMatch, forOneArbitraryMatch, getAllMatches, getAllMatches, getAllValues, getAllValues, getCapabilities, getEngine, getOneArbitraryMatch, getOneArbitraryMatch, getParameterNames, getPatternName, getPositionOfParameter, getSpecification, hasMatch, hasMatch, matchToArray, newEmptyMatch, newMatch, rawAccumulateAllValues, rawCountMatches, rawForEachMatch, rawForOneArbitraryMatch, rawGetAllMatches, rawGetAllValues, rawGetOneArbitraryMatch, rawHasMatch, setBackend
public static GeneralizationMatcher on(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine)
engine
- the existing VIATRA Query engine in which this matcher will be created.ViatraQueryRuntimeException
- if an error occurs during pattern matcher creationpublic static GeneralizationMatcher create()
ViatraQueryRuntimeException
- if an error occurs during pattern matcher creationpublic java.util.Collection<GeneralizationMatch> getAllMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.public GeneralizationMatch getOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.public boolean hasMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.public int countMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.public void forEachMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super GeneralizationMatch> processor)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.processor
- the action that will process each pattern match.public boolean forOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super GeneralizationMatch> processor)
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.processor
- the action that will process the selected match.public GeneralizationMatch newMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral, com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
The returned match will be immutable. Use BaseMatcher.newEmptyMatch()
to obtain a mutable match object.
pGeneral
- the fixed value of pattern parameter general, or null if not bound.pSpecific
- the fixed value of pattern parameter specific, or null if not bound.protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> rawAccumulateAllValuesOfgeneral(java.lang.Object[] parameters)
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfgeneral()
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfgeneral(GeneralizationMatch partialMatch)
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfgeneral(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pSpecific)
protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> rawAccumulateAllValuesOfspecific(java.lang.Object[] parameters)
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfspecific()
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfspecific(GeneralizationMatch partialMatch)
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfspecific(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pGeneral)
protected GeneralizationMatch tupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t)
tupleToMatch
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<GeneralizationMatch>
protected GeneralizationMatch arrayToMatch(java.lang.Object[] match)
arrayToMatch
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<GeneralizationMatch>
protected GeneralizationMatch arrayToMatchMutable(java.lang.Object[] match)
arrayToMatchMutable
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<GeneralizationMatch>
public static org.eclipse.viatra.query.runtime.api.IQuerySpecification<GeneralizationMatcher> querySpecification()
ViatraQueryRuntimeException
- if the pattern definition could not be loaded