public class ChildrenMatcher extends org.eclipse.viatra.query.runtime.api.impl.BaseMatcher<ChildrenMatch>
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 ChildrenMatch
.
Original source:
@QueryExplorer(checked = false)
pattern children(parent:Item, child:Item) {
Containment.source(c, parent);
Containment.target(c, child);
}
ChildrenMatch
,
ChildrenProcessor
,
ChildrenQuerySpecification
Modifier and Type | Method and Description |
---|---|
int |
countMatches(Item pParent,
Item pChild)
Returns the number of all matches of the pattern that conform to the given fixed values of some parameters.
|
void |
forEachMatch(Item pParent,
Item pChild,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super ChildrenMatch> processor)
Executes the given processor on each match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
forOneArbitraryMatch(Item pParent,
Item pChild,
org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super ChildrenMatch> 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<ChildrenMatch> |
getAllMatches(Item pParent,
Item pChild)
Returns the set of all matches of the pattern that conform to the given fixed values of some parameters.
|
java.util.Set<Item> |
getAllValuesOfchild()
Retrieve the set of values that occur in matches for child.
|
java.util.Set<Item> |
getAllValuesOfchild(ChildrenMatch partialMatch)
Retrieve the set of values that occur in matches for child.
|
java.util.Set<Item> |
getAllValuesOfchild(Item pParent)
Retrieve the set of values that occur in matches for child.
|
java.util.Set<Item> |
getAllValuesOfparent()
Retrieve the set of values that occur in matches for parent.
|
java.util.Set<Item> |
getAllValuesOfparent(ChildrenMatch partialMatch)
Retrieve the set of values that occur in matches for parent.
|
java.util.Set<Item> |
getAllValuesOfparent(Item pChild)
Retrieve the set of values that occur in matches for parent.
|
ChildrenMatch |
getOneArbitraryMatch(Item pParent,
Item pChild)
Returns an arbitrarily chosen match of the pattern that conforms to the given fixed values of some parameters.
|
boolean |
hasMatch(Item pParent,
Item pChild)
Indicates whether the given combination of specified pattern parameters constitute a valid pattern match,
under any possible substitution of the unspecified parameters (if any).
|
ChildrenMatch |
newMatch(Item pParent,
Item pChild)
Returns a new (partial) match.
|
static ChildrenMatcher |
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<ChildrenMatcher> |
querySpecification() |
countMatches, countMatches, forEachMatch, forEachMatch, forOneArbitraryMatch, forOneArbitraryMatch, getAllMatches, getAllMatches, getAllValues, getAllValues, getEngine, getOneArbitraryMatch, getOneArbitraryMatch, getParameterNames, getPatternName, getPositionOfParameter, getSpecification, hasMatch, newEmptyMatch, newMatch
public static ChildrenMatcher on(org.eclipse.viatra.query.runtime.api.ViatraQueryEngine engine) throws org.eclipse.viatra.query.runtime.exception.ViatraQueryException
engine
- the existing VIATRA Query engine in which this matcher will be created.org.eclipse.viatra.query.runtime.exception.ViatraQueryException
- if an error occurs during pattern matcher creationpublic java.util.Collection<ChildrenMatch> getAllMatches(Item pParent, Item pChild)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.public ChildrenMatch getOneArbitraryMatch(Item pParent, Item pChild)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.public boolean hasMatch(Item pParent, Item pChild)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.public int countMatches(Item pParent, Item pChild)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.public void forEachMatch(Item pParent, Item pChild, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super ChildrenMatch> processor)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.processor
- the action that will process each pattern match.public boolean forOneArbitraryMatch(Item pParent, Item pChild, org.eclipse.viatra.query.runtime.api.IMatchProcessor<? super ChildrenMatch> processor)
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.processor
- the action that will process the selected match.public ChildrenMatch newMatch(Item pParent, Item pChild)
The returned match will be immutable. Use BaseMatcher.newEmptyMatch()
to obtain a mutable match object.
pParent
- the fixed value of pattern parameter parent, or null if not bound.pChild
- the fixed value of pattern parameter child, or null if not bound.public java.util.Set<Item> getAllValuesOfparent()
public java.util.Set<Item> getAllValuesOfparent(ChildrenMatch partialMatch)
public java.util.Set<Item> getAllValuesOfparent(Item pChild)
public java.util.Set<Item> getAllValuesOfchild()
public java.util.Set<Item> getAllValuesOfchild(ChildrenMatch partialMatch)
public java.util.Set<Item> getAllValuesOfchild(Item pParent)
public static org.eclipse.viatra.query.runtime.api.IQuerySpecification<ChildrenMatcher> querySpecification() throws org.eclipse.viatra.query.runtime.exception.ViatraQueryException
org.eclipse.viatra.query.runtime.exception.ViatraQueryException
- if the pattern definition could not be loaded