Package spoon.pattern.internal.node
Interface RootNode
- All Superinterfaces:
Matchers
- All Known Subinterfaces:
InlineNode,PrimitiveMatcher,RepeatableMatcher
- All Known Implementing Classes:
AbstractNode,ConstantNode,ElementNode,ForEachNode,ListOfNodes,MapEntryNode,ParameterNode,StringNode,SwitchNode
Represents a parameterized Pattern ValueResolver, which can be used
- to generate a zero, one or more copies of model using provided parameters
- to match zero, one or more instances of model and deliver a matching parameters
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidforEachParameterInfo(BiConsumer<ParameterInfo,RootNode> consumer)Calls consumer for each pair of parameter definition (ParameterInfo) andRootNode, which uses it<T> voidgenerateTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)Generates zero, one or more target depending on kind of thisRootNode, expected `result` and input `parameters`booleandefault TobeMatchedmatchAllWith(TobeMatched targets)Matches all matchers of thisMatchersinstance with `targets`matchTargets(TobeMatched targets, Matchers nextMatchers)booleanreplaceNode(RootNode oldNode, RootNode newNode)Call it to modify Pattern structure.voidsetSimplifyGenerated(boolean simplifyGenerated)
-
Field Details
-
MATCH_ALL
-
MATCH_PART
-
-
Method Details
-
forEachParameterInfo
Calls consumer for each pair of parameter definition (ParameterInfo) andRootNode, which uses it- Parameters:
consumer- the receiver of pairs ofParameterInfoandRootNode
-
generateTargets
<T> void generateTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)Generates zero, one or more target depending on kind of thisRootNode, expected `result` and input `parameters`- Parameters:
generator-Generatorwhich drives generation processresult- holder for the generated objectsparameters- aImmutableMapholding parameters
-
isSimplifyGenerated
boolean isSimplifyGenerated()- Returns:
- true if generated result has to be evaluated to apply simplifications. e.g. ("a" + "b") id simplified to "ab"
-
setSimplifyGenerated
void setSimplifyGenerated(boolean simplifyGenerated)- Parameters:
simplifyGenerated- true if generated result of thisRootNodehas to be evaluated to apply simplifications.
-
matchTargets
- Parameters:
targets- to be matched target nodes and input parametersnextMatchers- Chain of matchers which has to be processed after thisRootNode- Returns:
- new parameters and container with remaining targets
-
matchAllWith
Description copied from interface:MatchersMatches all matchers of thisMatchersinstance with `targets`- Specified by:
matchAllWithin interfaceMatchers- Parameters:
targets- to be matched target nodes and input parameters- Returns:
TobeMatchedwith targets which remained after allRootNodes were matched + matched parameters
-
replaceNode
Call it to modify Pattern structure. It is actually called mainly by PatternBuilder. TODO: May be we can move this method into some internal interface?
-