Match
- public abstract class BaseMatcher<Match extends IPatternMatch> extends QueryResultWrapper implements IncQueryMatcher<Match>
Constructor and Description |
---|
BaseMatcher(IncQueryEngine engine,
IQuerySpecification<? extends BaseMatcher<Match>> querySpecification) |
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(IMatchProcessor<? super Match> processor)
Executes the given processor on each match of the pattern.
|
void |
forEachMatch(Match match,
IMatchProcessor<? 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(IMatchProcessor<? super Match> processor)
Executes the given processor on an arbitrarily chosen match of the pattern.
|
boolean |
forOneArbitraryMatch(Match partialMatch,
IMatchProcessor<? 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.
|
IncQueryEngine |
getEngine()
Returns the engine that the matcher uses.
|
Match |
getOneArbitraryMatch()
Returns an arbitrarily chosen pattern match.
|
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 BaseMatcher<Match>> |
getSpecification()
The pattern that will be matched.
|
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.
|
public BaseMatcher(IncQueryEngine engine, IQuerySpecification<? extends BaseMatcher<Match>> querySpecification) throws IncQueryException
IncQueryException
public java.lang.Integer getPositionOfParameter(java.lang.String parameterName)
IncQueryMatcher
getPositionOfParameter
in interface IncQueryMatcher<Match extends IPatternMatch>
public java.util.List<java.lang.String> getParameterNames()
IncQueryMatcher
getParameterNames
in interface IncQueryMatcher<Match extends IPatternMatch>
public java.util.Collection<Match> getAllMatches()
IncQueryMatcher
getAllMatches
in interface IncQueryMatcher<Match extends IPatternMatch>
public java.util.Collection<Match> getAllMatches(Match partialMatch)
IncQueryMatcher
getAllMatches
in interface IncQueryMatcher<Match extends IPatternMatch>
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.public Match getOneArbitraryMatch()
IncQueryMatcher
getOneArbitraryMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
public Match getOneArbitraryMatch(Match partialMatch)
IncQueryMatcher
getOneArbitraryMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.public boolean hasMatch(Match partialMatch)
IncQueryMatcher
hasMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
partialMatch
- a (partial) match of the pattern where each non-null field binds the corresponding pattern parameter
to a fixed value.public int countMatches()
IncQueryMatcher
countMatches
in interface IncQueryMatcher<Match extends IPatternMatch>
public int countMatches(Match partialMatch)
IncQueryMatcher
countMatches
in interface IncQueryMatcher<Match extends IPatternMatch>
partialMatch
- a partial match of the pattern where each non-null field binds the corresponding pattern parameter to
a fixed value.public void forEachMatch(IMatchProcessor<? super Match> processor)
IncQueryMatcher
forEachMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
processor
- the action that will process each pattern match.public void forEachMatch(Match match, IMatchProcessor<? super Match> processor)
IncQueryMatcher
forEachMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
match
- array where each non-null element binds the corresponding pattern parameter to a fixed value.processor
- the action that will process each pattern match.public boolean forOneArbitraryMatch(IMatchProcessor<? super Match> processor)
IncQueryMatcher
forOneArbitraryMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
processor
- the action that will process the selected match.public boolean forOneArbitraryMatch(Match partialMatch, IMatchProcessor<? super Match> processor)
IncQueryMatcher
forOneArbitraryMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
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.public Match newEmptyMatch()
IncQueryMatcher
newEmptyMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
public Match newMatch(java.lang.Object... parameters)
IncQueryMatcher
The returned match will be immutable. Use IncQueryMatcher.newEmptyMatch()
to obtain a mutable match object.
newMatch
in interface IncQueryMatcher<Match extends IPatternMatch>
parameters
- the fixed value of pattern parameters, or null if not bound.public java.util.Set<java.lang.Object> getAllValues(java.lang.String parameterName)
IncQueryMatcher
getAllValues
in interface IncQueryMatcher<Match extends IPatternMatch>
parameterName
- name of the parameter for which values are returnedpublic java.util.Set<java.lang.Object> getAllValues(java.lang.String parameterName, Match partialMatch)
IncQueryMatcher
getAllValues
in interface IncQueryMatcher<Match extends IPatternMatch>
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.public IncQueryEngine getEngine()
IncQueryMatcher
getEngine
in interface IncQueryMatcher<Match extends IPatternMatch>
public IQuerySpecification<? extends BaseMatcher<Match>> getSpecification()
IncQueryMatcher
getSpecification
in interface IncQueryMatcher<Match extends IPatternMatch>
public java.lang.String getPatternName()
IncQueryMatcher
getPatternName
in interface IncQueryMatcher<Match extends IPatternMatch>