Class FlowContainerDiff.Matcher
- All Implemented Interfaces:
org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<FlowContainerDiff.Match>
- Enclosing class:
FlowContainerDiff
Use the pattern matcher on a given model via on(ViatraQueryEngine),
e.g. in conjunction with ViatraQueryEngine.on(QueryScope).
Matches of the pattern will be represented as FlowContainerDiff.Match.
Original source:
/////////////////// supporting patterns ////////////////////
pattern flowContainerDiff(sender: DataFlowEntity, recipient : DataFlowEntity) {
DataFlowEntity(sender); DataFlowEntity(recipient);
find communication(sender, _df, recipient);
TrustBoundaryContainer(contain);
find contains(contain,sender);
neg find contains(contain,recipient);
} or {
DataFlowEntity(sender); DataFlowEntity(recipient);
find communication(sender, _df2, recipient);
TrustBoundaryContainer(contain);
find contains(contain,recipient);
neg find contains(contain,sender);
}
or {
DataFlowEntity(sender); DataFlowEntity(recipient);
find communication(recipient, _df, sender);
TrustBoundaryContainer(contain);
find contains(contain,sender);
neg find contains(contain,recipient);
} or {
DataFlowEntity(sender); DataFlowEntity(recipient);
find communication(recipient, _df2, sender);
TrustBoundaryContainer(contain);
find contains(contain,recipient);
neg find contains(contain,sender);
}
- See Also:
-
Field Summary
Fields inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher
engine, querySpecificationFields inherited from class org.eclipse.viatra.query.runtime.internal.apiimpl.QueryResultWrapper
backend -
Method Summary
Modifier and TypeMethodDescriptionprotected FlowContainerDiff.MatcharrayToMatch(Object[] match) protected FlowContainerDiff.MatcharrayToMatchMutable(Object[] match) intcountMatches(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.static FlowContainerDiff.Matchercreate()booleanforOneArbitraryMatch(DataFlowEntity pSender, DataFlowEntity pRecipient, Consumer<? super FlowContainerDiff.Match> processor) Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.getAllMatches(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.Retrieve the set of values that occur in matches for recipient.getAllValuesOfrecipient(FlowContainerDiff.Match partialMatch) Retrieve the set of values that occur in matches for recipient.getAllValuesOfrecipient(DataFlowEntity pSender) Retrieve the set of values that occur in matches for recipient.Retrieve the set of values that occur in matches for sender.getAllValuesOfsender(FlowContainerDiff.Match partialMatch) Retrieve the set of values that occur in matches for sender.getAllValuesOfsender(DataFlowEntity pRecipient) Retrieve the set of values that occur in matches for sender.getOneArbitraryMatch(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.booleanhasMatch(DataFlowEntity pSender, DataFlowEntity pRecipient) Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under any possible substitution of the unspecified parameters (if any).newMatch(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns a new (partial) match.static FlowContainerDiff.Matcheron(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<FlowContainerDiff.Matcher> protected Stream<DataFlowEntity> rawStreamAllValuesOfrecipient(Object[] parameters) Retrieve the set of values that occur in matches for recipient.protected Stream<DataFlowEntity> rawStreamAllValuesOfsender(Object[] parameters) Retrieve the set of values that occur in matches for sender.streamAllMatches(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.Retrieve the set of values that occur in matches for recipient.streamAllValuesOfrecipient(FlowContainerDiff.Match partialMatch) Retrieve the set of values that occur in matches for recipient.streamAllValuesOfrecipient(DataFlowEntity pSender) Retrieve the set of values that occur in matches for recipient.Retrieve the set of values that occur in matches for sender.streamAllValuesOfsender(FlowContainerDiff.Match partialMatch) Retrieve the set of values that occur in matches for sender.streamAllValuesOfsender(DataFlowEntity pRecipient) Retrieve the set of values that occur in matches for sender.protected FlowContainerDiff.MatchtupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t) Methods inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseMatcher
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, rawGetOneArbitraryMatch, rawHasMatch, rawStreamAllMatches, rawStreamAllValues, setBackend, streamAllMatches, streamAllMatches
-
Method Details
-
on
public static FlowContainerDiff.Matcher on(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine) Initializes the pattern matcher within an existing VIATRA Query engine. If the pattern matcher is already constructed in the engine, only a light-weight reference is returned.- Parameters:
engine- the existing VIATRA Query engine in which this matcher will be created.
-
create
- Returns:
- an initialized matcher
-
getAllMatches
public Collection<FlowContainerDiff.Match> getAllMatches(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- matches represented as a Match object.
-
streamAllMatches
public Stream<FlowContainerDiff.Match> streamAllMatches(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters. NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely onBaseMatcher.getAllMatches()or collect the results of the stream in end-user code.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- a stream of matches represented as a Match object.
-
getOneArbitraryMatch
public Optional<FlowContainerDiff.Match> getOneArbitraryMatch(DataFlowEntity pSender, DataFlowEntity pRecipient) Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- a match represented as a Match object, or null if no match is found.
-
hasMatch
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under any possible substitution of the unspecified parameters (if any).- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- true if the input is a valid (partial) match of the pattern.
-
countMatches
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- the number of pattern matches found.
-
forOneArbitraryMatch
public boolean forOneArbitraryMatch(DataFlowEntity pSender, DataFlowEntity pRecipient, Consumer<? super FlowContainerDiff.Match> processor) Executes the given processor on an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters. Neither determinism nor randomness of selection is guaranteed.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.processor- the action that will process the selected match.- Returns:
- true if the pattern has at least one match with the given parameter values, false if the processor was not invoked
-
newMatch
Returns a new (partial) match. This can be used e.g. to call the matcher with a partial match.The returned match will be immutable. Use
BaseMatcher.newEmptyMatch()to obtain a mutable match object.- Parameters:
pSender- the fixed value of pattern parameter sender, or null if not bound.pRecipient- the fixed value of pattern parameter recipient, or null if not bound.- Returns:
- the (partial) match object.
-
rawStreamAllValuesOfsender
Retrieve the set of values that occur in matches for sender.- Returns:
- the Set of all values or empty set if there are no matches
-
getAllValuesOfsender
Retrieve the set of values that occur in matches for sender.- Returns:
- the Set of all values or empty set if there are no matches
-
streamAllValuesOfsender
Retrieve the set of values that occur in matches for sender.- Returns:
- the Set of all values or empty set if there are no matches
-
streamAllValuesOfsender
Retrieve the set of values that occur in matches for sender. NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely onBaseMatcher.getAllMatches()or collect the results of the stream in end-user code.- Returns:
- the Stream of all values or empty set if there are no matches
-
streamAllValuesOfsender
Retrieve the set of values that occur in matches for sender. NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely onBaseMatcher.getAllMatches()or collect the results of the stream in end-user code.- Returns:
- the Stream of all values or empty set if there are no matches
-
getAllValuesOfsender
Retrieve the set of values that occur in matches for sender.- Returns:
- the Set of all values or empty set if there are no matches
-
getAllValuesOfsender
Retrieve the set of values that occur in matches for sender.- Returns:
- the Set of all values or empty set if there are no matches
-
rawStreamAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient.- Returns:
- the Set of all values or empty set if there are no matches
-
getAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient.- Returns:
- the Set of all values or empty set if there are no matches
-
streamAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient.- Returns:
- the Set of all values or empty set if there are no matches
-
streamAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient. NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely onBaseMatcher.getAllMatches()or collect the results of the stream in end-user code.- Returns:
- the Stream of all values or empty set if there are no matches
-
streamAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient. NOTE: It is important not to modify the source model while the stream is being processed. If the match set of the pattern changes during processing, the contents of the stream is undefined. In such cases, either rely onBaseMatcher.getAllMatches()or collect the results of the stream in end-user code.- Returns:
- the Stream of all values or empty set if there are no matches
-
getAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient.- Returns:
- the Set of all values or empty set if there are no matches
-
getAllValuesOfrecipient
Retrieve the set of values that occur in matches for recipient.- Returns:
- the Set of all values or empty set if there are no matches
-
tupleToMatch
protected FlowContainerDiff.Match tupleToMatch(org.eclipse.viatra.query.runtime.matchers.tuple.Tuple t) - Specified by:
tupleToMatchin classorg.eclipse.viatra.query.runtime.api.impl.BaseMatcher<FlowContainerDiff.Match>
-
arrayToMatch
- Specified by:
arrayToMatchin classorg.eclipse.viatra.query.runtime.api.impl.BaseMatcher<FlowContainerDiff.Match>
-
arrayToMatchMutable
- Specified by:
arrayToMatchMutablein classorg.eclipse.viatra.query.runtime.api.impl.BaseMatcher<FlowContainerDiff.Match>
-
querySpecification
public static org.eclipse.viatra.query.runtime.api.IQuerySpecification<FlowContainerDiff.Matcher> querySpecification()- Returns:
- the singleton instance of the query specification of this pattern
-