Package spoon.pattern.internal.node
Class ParameterNode
java.lang.Object
spoon.pattern.internal.node.AbstractNode
spoon.pattern.internal.node.ParameterNode
- All Implemented Interfaces:
- Matchers,- PrimitiveMatcher,- RepeatableMatcher,- RootNode
Represents pattern model variable
 Delivers/Matches 0, 1 or more values of defined parameter.
 The values may have type which extends 
CtElement or any other type of some SpoonModel attribute. E.g. String- 
Field SummaryFields inherited from interface spoon.pattern.internal.node.RootNodeMATCH_ALL, MATCH_PART
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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`If twoRepeatableMatchers in a list are matching the same element, then returnedQuantifierdefines how resolve this conflictbooleanisMandatory(ImmutableMap parameters)booleanbooleanisTryNextMatch(ImmutableMap parameters)matchAllWith(TobeMatched tobeMatched)Matches all matchers of thisMatchersinstance with `targets`matchTarget(Object target, ImmutableMap parameters)matchTargets(TobeMatched targets, Matchers next)booleanreplaceNode(RootNode oldNode, RootNode newNode)Call it to modify Pattern structure.toString()Methods inherited from class spoon.pattern.internal.node.AbstractNodeisSimplifyGenerated, setSimplifyGeneratedMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface spoon.pattern.internal.node.RootNodeisSimplifyGenerated, matchTargets, setSimplifyGenerated
- 
Constructor Details- 
ParameterNode
 
- 
- 
Method Details- 
replaceNodeDescription copied from interface:RootNodeCall it to modify Pattern structure. It is actually called mainly by PatternBuilder. TODO: May be we can move this method into some internal interface?
- 
generateTargetspublic <T> void generateTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)Description copied from interface:RootNodeGenerates zero, one or more target depending on kind of thisRootNode, expected `result` and input `parameters`- Parameters:
- generator-- Generatorwhich drives generation process
- result- holder for the generated objects
- parameters- a- ImmutableMapholding parameters
 
- 
matchTarget- Parameters:
- target- - to be matched element
- parameters- will receive the matching parameter values
- Returns:
- true if `element` matches with pattern of this matcher
 
- 
getParameterInfo
- 
isRepeatablepublic boolean isRepeatable()- Returns:
- true if this matcher can be applied more then once in the same container of targets Note: even if false, it may be applied again to another container and to match EQUAL value
 
- 
isMandatory- Parameters:
- parameters- matching parameters
- Returns:
- true if this ValueResolver MUST match with next target in the state defined by current `parameters`. false if match is optional
 
- 
isTryNextMatch- Parameters:
- parameters- matching parameters
- Returns:
- true if this ValueResolver should be processed again to match next target in the state defined by current `parameters`.
 
- 
getMatchingStrategyDescription copied from interface:RepeatableMatcherIf twoRepeatableMatchers in a list are matching the same element, then returnedQuantifierdefines how resolve this conflict- Returns:
- Quantifier
 
- 
forEachParameterInfoDescription copied from interface:RootNodeCalls consumer for each pair of parameter definition (ParameterInfo) andRootNode, which uses it- Parameters:
- consumer- the receiver of pairs of- ParameterInfoand- RootNode
 
- 
toString- Overrides:
- toStringin class- AbstractNode
 
- 
matchAllWithDescription copied from interface:MatchersMatches all matchers of thisMatchersinstance with `targets`- Specified by:
- matchAllWithin interface- Matchers
- Specified by:
- matchAllWithin interface- RootNode
- Parameters:
- tobeMatched- to be matched target nodes and input parameters
- Returns:
- TobeMatchedwith targets which remained after all- RootNodes were matched + matched parameters
 
- 
matchTargets- Specified by:
- matchTargetsin interface- RootNode
- Parameters:
- targets- to be matched target nodes and input parameters
- next- Chain of matchers which has to be processed after this- RootNode
- Returns:
- new parameters and container with remaining targets
 
 
-