public class ChildrenMatcher extends BaseMatcher<ChildrenMatch>
Use the pattern matcher on a given model via on(IncQueryEngine)
,
e.g. in conjunction with IncQueryEngine.on(Notifier)
.
Matches of the pattern will be represented as ChildrenMatch
.
Original source:
pattern children(parent:Item, child:Item) {
Containment.source(c, parent);
Containment.target(c, child);
}
ChildrenMatch
,
ChildrenProcessor
,
ChildrenQuerySpecification
Constructor and Description |
---|
ChildrenMatcher(IncQueryEngine engine)
Deprecated.
use
on(IncQueryEngine) instead |
ChildrenMatcher(org.eclipse.emf.common.notify.Notifier emfRoot)
Deprecated.
use
on(IncQueryEngine) instead, e.g. in conjunction with IncQueryEngine.on(Notifier) |
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,
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(IncQueryEngine engine)
Initializes the pattern matcher within an existing EMF-IncQuery engine.
|
static IQuerySpecification<ChildrenMatcher> |
querySpecification() |
countMatches, countMatches, forEachMatch, forEachMatch, forOneArbitraryMatch, forOneArbitraryMatch, getAllMatches, getAllMatches, getAllValues, getAllValues, getEngine, getOneArbitraryMatch, getOneArbitraryMatch, getParameterNames, getPatternName, getPositionOfParameter, getSpecification, hasMatch, newEmptyMatch, newMatch
@Deprecated public ChildrenMatcher(org.eclipse.emf.common.notify.Notifier emfRoot) throws IncQueryException
on(IncQueryEngine)
instead, e.g. in conjunction with IncQueryEngine.on(Notifier)
The matcher will be created within the managed IncQueryEngine
belonging to the EMF model root, so
multiple matchers will reuse the same engine and benefit from increased performance and reduced memory footprint.
emfRoot
- the root of the EMF containment hierarchy where the pattern matcher will operate. Recommended: Resource or ResourceSet.IncQueryException
- if an error occurs during pattern matcher creation@Deprecated public ChildrenMatcher(IncQueryEngine engine) throws IncQueryException
on(IncQueryEngine)
insteadengine
- the existing EMF-IncQuery engine in which this matcher will be created.IncQueryException
- if an error occurs during pattern matcher creationpublic static ChildrenMatcher on(IncQueryEngine engine) throws IncQueryException
engine
- the existing EMF-IncQuery engine in which this matcher will be created.IncQueryException
- 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.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 IQuerySpecification<ChildrenMatcher> querySpecification() throws IncQueryException
IncQueryException
- if the pattern definition could not be loaded