public class ChildrenMatcher extends 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,
ChildrenQuerySpecificationengine, querySpecification| Modifier and Type | Method and Description |
|---|---|
protected ChildrenMatch |
arrayToMatch(java.lang.Object[] match)
Converts the array representation of a pattern match to an immutable Match object.
|
protected ChildrenMatch |
arrayToMatchMutable(java.lang.Object[] match)
Converts the array representation of a pattern match to a mutable Match object.
|
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.
|
static ChildrenMatcher |
create() |
void |
forEachMatch(Item pParent,
Item pChild,
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,
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(ViatraQueryEngine engine)
Initializes the pattern matcher within an existing VIATRA Query engine.
|
static IQuerySpecification<ChildrenMatcher> |
querySpecification() |
protected java.util.Set<Item> |
rawAccumulateAllValuesOfchild(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for child.
|
protected java.util.Set<Item> |
rawAccumulateAllValuesOfparent(java.lang.Object[] parameters)
Retrieve the set of values that occur in matches for parent.
|
protected ChildrenMatch |
tupleToMatch(Tuple t) |
countMatches, countMatches, emptyArray, forEachMatch, forEachMatch, forOneArbitraryMatch, forOneArbitraryMatch, getAllMatches, getAllMatches, getAllValues, getAllValues, getCapabilities, getEngine, getOneArbitraryMatch, getOneArbitraryMatch, getParameterNames, getPatternName, getPositionOfParameter, getSpecification, hasMatch, matchToArray, newEmptyMatch, newMatch, rawAccumulateAllValues, rawCountMatches, rawForEachMatch, rawForOneArbitraryMatch, rawGetAllMatches, rawGetAllValues, rawGetOneArbitraryMatch, rawHasMatch, setBackendpublic static ChildrenMatcher on(ViatraQueryEngine engine) throws ViatraQueryException
engine - the existing VIATRA Query engine in which this matcher will be created.ViatraQueryException - if an error occurs during pattern matcher creationpublic static ChildrenMatcher create() throws ViatraQueryException
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, 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, 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.protected java.util.Set<Item> rawAccumulateAllValuesOfparent(java.lang.Object[] parameters)
public java.util.Set<Item> getAllValuesOfparent()
public java.util.Set<Item> getAllValuesOfparent(ChildrenMatch partialMatch)
public java.util.Set<Item> getAllValuesOfparent(Item pChild)
protected java.util.Set<Item> rawAccumulateAllValuesOfchild(java.lang.Object[] parameters)
public java.util.Set<Item> getAllValuesOfchild()
public java.util.Set<Item> getAllValuesOfchild(ChildrenMatch partialMatch)
public java.util.Set<Item> getAllValuesOfchild(Item pParent)
protected ChildrenMatch tupleToMatch(Tuple t)
tupleToMatch in class BaseMatcher<ChildrenMatch>protected ChildrenMatch arrayToMatch(java.lang.Object[] match)
BaseMatcherarrayToMatch in class BaseMatcher<ChildrenMatch>protected ChildrenMatch arrayToMatchMutable(java.lang.Object[] match)
BaseMatcherarrayToMatchMutable in class BaseMatcher<ChildrenMatch>public static IQuerySpecification<ChildrenMatcher> querySpecification() throws ViatraQueryException
ViatraQueryException - if the pattern definition could not be loaded