Package jetbrains.mps.lang.pattern
Class NodeMatcher
- java.lang.Object
 - 
- jetbrains.mps.lang.pattern.NodeMatcher
 
 
- 
public final class NodeMatcher extends Object
Match/extract values of a node against pattern/sample node. Not thread-safe. IMPLEMENTATION NODE: Pattern node passed tomatch(SNode, SNode)doesn't need to have set properties/association/aggregation we are going to capture/iterate with distinct matcher.- Since:
 - 3.4
 
 
- 
- 
Constructor Summary
Constructors Constructor Description NodeMatcher(ValueContainer vc) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeMatcherany()'wildcard' node match (aka '_')NodeMatcherassociation(SReferenceLink l, String linkVarName)NodeMatchercapture(String nodeVarName)ChildMatcherchild(SContainmentLink role)NodeMatcherdisjunct(SNode patternNode, NodeMatcher disjunct)Tells to match disjunction of nodes using supplied alternatives.ChildMatcherdone()booleanmatch(SNode pattern, SNode against)NodeMatcherproperty(SProperty p, String patternVarName) 
 - 
 
- 
- 
Constructor Detail
- 
NodeMatcher
public NodeMatcher(@NotNull ValueContainer vc)
 
 - 
 
- 
Method Detail
- 
property
public NodeMatcher property(@NotNull SProperty p, @NotNull String patternVarName)
 
- 
capture
public NodeMatcher capture(String nodeVarName)
 
- 
any
public NodeMatcher any()
'wildcard' node match (aka '_')- Returns:
 this
 
- 
association
public NodeMatcher association(@NotNull SReferenceLink l, @NotNull String linkVarName)
 
- 
child
public ChildMatcher child(@NotNull SContainmentLink role)
 
- 
disjunct
public NodeMatcher disjunct(@NotNull SNode patternNode, @NotNull NodeMatcher disjunct)
Tells to match disjunction of nodes using supplied alternatives.NodeMatcherwith alternatives doesn't check children, associations or properties. It's still possible, though, to capture value of the node withcapture(String). When matching, each disjunct is processed in order they were added to the matcher, the first one to match cancels processing of other (i.e. similar to Java's || operator).- Parameters:
 patternNode- pattern to match disjunct against.disjunct- ordered matcher sequence, consulted one my one until match is found.- Returns:
 this
 
- 
done
public ChildMatcher done()
 
 - 
 
 -