public class BlockMatcher extends org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<BlockMatch>
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 BlockMatch
.
Original source:
Queries instances of block objects
pattern block(class : Class) {
Classifier.name(block, "Block");
InstanceSpecification.classifier(instance, block);
Class.appliedStereotypeInstance(class, instance);
}
BlockMatch
,
BlockProcessor
,
BlockQuerySpecification
Modifier and Type | Method and Description |
---|---|
protected BlockMatch |
arrayToMatch(java.lang.Object[] match) |
protected BlockMatch |
arrayToMatchMutable(java.lang.Object[] match) |
int |
countMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
static BlockMatcher |
create() |
void |
forEachMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super BlockMatch> 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 pClass,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super BlockMatch> 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<BlockMatch> |
getAllMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
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> |
getAllValuesOfclass()
Retrieve the set of values that occur in matches for class.
|
BlockMatch |
getOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
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 pClass)
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
under any possible substitution of the unspecified parameters (if any).
|
BlockMatch |
newMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
Returns a new (partial) match.
|
static BlockMatcher |
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<BlockMatcher> |
querySpecification() |
protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> |
rawAccumulateAllValuesOfclass(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for class.
|
protected BlockMatch |
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 BlockMatcher 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 BlockMatcher create()
ViatraQueryRuntimeException
- if an error occurs during pattern matcher creationpublic java.util.Collection<BlockMatch> getAllMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
pClass
- the fixed value of pattern parameter class, or null if not bound.public BlockMatch getOneArbitraryMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
pClass
- the fixed value of pattern parameter class, or null if not bound.public boolean hasMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
pClass
- the fixed value of pattern parameter class, or null if not bound.public int countMatches(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
pClass
- the fixed value of pattern parameter class, or null if not bound.public void forEachMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super BlockMatch> processor)
pClass
- the fixed value of pattern parameter class, 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 pClass, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super BlockMatch> processor)
pClass
- the fixed value of pattern parameter class, or null if not bound.processor
- the action that will process the selected match.public BlockMatch newMatch(com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class pClass)
The returned match will be immutable. Use BaseMatcher.newEmptyMatch()
to obtain a mutable match object.
pClass
- the fixed value of pattern parameter class, or null if not bound.protected java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> rawAccumulateAllValuesOfclass(java.lang.Object[] parameters)
public java.util.Set<com.nomagic.uml2.ext.magicdraw.classes.mdkernel.Class> getAllValuesOfclass()
protected BlockMatch tupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t)
tupleToMatch
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<BlockMatch>
protected BlockMatch arrayToMatch(java.lang.Object[] match)
arrayToMatch
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<BlockMatch>
protected BlockMatch arrayToMatchMutable(java.lang.Object[] match)
arrayToMatchMutable
in class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<BlockMatch>
public static org.eclipse.viatra.query.runtime.api.IQuerySpecification<BlockMatcher> querySpecification()
ViatraQueryRuntimeException
- if the pattern definition could not be loaded