Match
- the IPatternMatch type representing a single match of this pattern.public interface ViatraQueryMatcher<Match extends IPatternMatch>
Modifier and Type | Method and Description |
---|---|
int |
countMatches()
Returns the number of all pattern matches.
|
int |
countMatches(Match partialMatch)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
void |
forEachMatch(java.util.function.Consumer<? super Match> processor)
Executes the given processor on each match of the pattern.
|
void |
forEachMatch(Match partialMatch,
java.util.function.Consumer<? super Match> processor)
Executes the given processor on each match of the pattern that conforms to the given fixed values of some
parameters.
|
boolean |
forOneArbitraryMatch(java.util.function.Consumer<? super Match> processor)
Executes the given processor on an arbitrarily chosen match of the pattern.
|
boolean |
forOneArbitraryMatch(Match partialMatch,
java.util.function.Consumer<? super Match> 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<Match> |
getAllMatches()
Returns the set of all pattern matches.
|
java.util.Collection<Match> |
getAllMatches(Match partialMatch)
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
|
java.util.Set<java.lang.Object> |
getAllValues(java.lang.String parameterName)
Retrieve the set of values that occur in matches for the given parameterName.
|
java.util.Set<java.lang.Object> |
getAllValues(java.lang.String parameterName,
Match partialMatch)
Retrieve the set of values that occur in matches for the given parameterName, that conforms to the given fixed
values of some parameters.
|
ViatraQueryEngine |
getEngine()
Returns the engine that the matcher uses.
|
java.util.Optional<Match> |
getOneArbitraryMatch()
Returns an arbitrarily chosen pattern match.
|
java.util.Optional<Match> |
getOneArbitraryMatch(Match partialMatch)
Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
java.util.List<java.lang.String> |
getParameterNames()
Returns the array of symbolic parameter names.
|
java.lang.String |
getPatternName()
Fully qualified name of the pattern.
|
java.lang.Integer |
getPositionOfParameter(java.lang.String parameterName)
Returns the index of the symbolic parameter with the given name.
|
IQuerySpecification<? extends ViatraQueryMatcher<Match>> |
getSpecification()
The pattern that will be matched.
|
boolean |
hasMatch()
Indicates whether the query has any kind of matches.
|
boolean |
hasMatch(Match partialMatch)
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match, under
any possible substitution of the unspecified parameters (if any).
|
Match |
newEmptyMatch()
Returns an empty, mutable Match for the matcher.
|
Match |
newMatch(java.lang.Object... parameters)
Returns a new (partial) Match object for the matcher.
|
java.util.stream.Stream<Match> |
streamAllMatches()
Returns a stream of all pattern matches.
|
java.util.stream.Stream<Match> |
streamAllMatches(Match partialMatch)
Returns a stream of all matches of the pattern that conform to the given fixed values of some parameters.
|
IQuerySpecification<? extends ViatraQueryMatcher<Match>> getSpecification()
java.lang.String getPatternName()
java.lang.Integer getPositionOfParameter(java.lang.String parameterName)
java.util.List<java.lang.String> getParameterNames()
java.util.Collection<Match> getAllMatches()
java.util.Collection<Match> getAllMatches(Match partialMatch)
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.java.util.stream.Stream<Match> streamAllMatches()
WARNING If the result set changes while the stream is evaluated, the set of matches included in
the stream are unspecified. In such cases, either rely on getAllMatches()
or collect the results of the
stream in end-user code.
java.util.stream.Stream<Match> streamAllMatches(Match partialMatch)
WARNING If the result set changes while the stream is evaluated, the set of matches included in
the stream are unspecified. In such cases, either rely on getAllMatches()
or collect the results of the
stream in end-user code.
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.java.util.Optional<Match> getOneArbitraryMatch()
java.util.Optional<Match> getOneArbitraryMatch(Match partialMatch)
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.boolean hasMatch()
boolean hasMatch(Match partialMatch)
partialMatch
- a (partial) match of the pattern where each non-null field binds the corresponding pattern parameter
to a fixed value.int countMatches()
int countMatches(Match partialMatch)
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.void forEachMatch(java.util.function.Consumer<? super Match> processor)
processor
- the action that will process each pattern match.void forEachMatch(Match partialMatch, java.util.function.Consumer<? super Match> processor)
partialMatch
- array where each non-null element binds the corresponding pattern parameter to a fixed value.processor
- the action that will process each pattern match.boolean forOneArbitraryMatch(java.util.function.Consumer<? super Match> processor)
processor
- the action that will process the selected match.boolean forOneArbitraryMatch(Match partialMatch, java.util.function.Consumer<? super Match> processor)
partialMatch
- array where each non-null element binds the corresponding pattern parameter to a fixed value.processor
- the action that will process the selected match.Match newEmptyMatch()
Match newMatch(java.lang.Object... parameters)
The returned match will be immutable. Use newEmptyMatch()
to obtain a mutable match object.
parameters
- the fixed value of pattern parameters, or null if not bound.java.util.Set<java.lang.Object> getAllValues(java.lang.String parameterName)
parameterName
- name of the parameter for which values are returnedjava.util.Set<java.lang.Object> getAllValues(java.lang.String parameterName, Match partialMatch)
parameterName
- name of the parameter for which values are returnedpartialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.ViatraQueryEngine getEngine()