public class ForEachNode extends AbstractNode implements InlineNode
System.out.println("a")
System.out.println("b")
System.out.println(getStringOf(p1, p2))
where parameter values are _x_ = ["a", "b", getStringOf(p1, p2)]MATCH_ALL, MATCH_PART
Constructor and Description |
---|
ForEachNode() |
Modifier and Type | Method and Description |
---|---|
void |
forEachParameterInfo(java.util.function.BiConsumer<ParameterInfo,RootNode> consumer)
Calls consumer for each pair of parameter definition (
ParameterInfo ) and RootNode , which uses it |
<T> void |
generateInlineTargets(DefaultGenerator generator,
ResultHolder<T> result,
ImmutableMap parameters)
Generates inline statements of this inline
RootNode . |
<T> void |
generateTargets(DefaultGenerator generator,
ResultHolder<T> result,
ImmutableMap parameters)
Generates zero, one or more target depending on kind of this
RootNode , expected `result` and input `parameters` |
Quantifier |
getMatchingStrategy()
If two
RepeatableMatcher s in a list are matching the same element,
then returned Quantifier defines how resolve this conflict |
boolean |
isMandatory(ImmutableMap parameters) |
boolean |
isRepeatable() |
boolean |
isTryNextMatch(ImmutableMap parameters) |
TobeMatched |
matchAllWith(TobeMatched tobeMatched)
Matches all matchers of this
Matchers instance with `targets` |
TobeMatched |
matchTargets(TobeMatched targets,
Matchers next) |
boolean |
replaceNode(RootNode oldNode,
RootNode newNode)
Call it to modify Pattern structure.
|
void |
setIterableParameter(PrimitiveMatcher substRequestOfIterable) |
void |
setLocalParameter(ParameterInfo parameterInfo) |
void |
setNestedModel(RootNode valueResolver) |
isSimplifyGenerated, setSimplifyGenerated, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isSimplifyGenerated, matchTargets, setSimplifyGenerated
public boolean replaceNode(RootNode oldNode, RootNode newNode)
RootNode
replaceNode
in interface RootNode
oldNode
- old RootNode
newNode
- new RootNode
RootNode
or it's children and replaced by `newNode`
false if `oldNode` was not foundpublic <T> void generateTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)
RootNode
RootNode
, expected `result` and input `parameters`generateTargets
in interface RootNode
generator
- Generator
which drives generation processresult
- holder for the generated objectsparameters
- a ImmutableMap
holding parameterspublic Quantifier getMatchingStrategy()
RepeatableMatcher
RepeatableMatcher
s in a list are matching the same element,
then returned Quantifier
defines how resolve this conflictgetMatchingStrategy
in interface RepeatableMatcher
Quantifier
public TobeMatched matchAllWith(TobeMatched tobeMatched)
Matchers
Matchers
instance with `targets`matchAllWith
in interface Matchers
matchAllWith
in interface RootNode
tobeMatched
- to be matched target nodes and input parametersTobeMatched
with targets which remained after all RootNode
s were matched + matched parameterspublic void forEachParameterInfo(java.util.function.BiConsumer<ParameterInfo,RootNode> consumer)
RootNode
ParameterInfo
) and RootNode
, which uses itforEachParameterInfo
in interface RootNode
consumer
- the receiver of pairs of ParameterInfo
and RootNode
public void setNestedModel(RootNode valueResolver)
public void setIterableParameter(PrimitiveMatcher substRequestOfIterable)
public void setLocalParameter(ParameterInfo parameterInfo)
public boolean isRepeatable()
isRepeatable
in interface RepeatableMatcher
public boolean isMandatory(ImmutableMap parameters)
isMandatory
in interface RepeatableMatcher
parameters
- matching parameterspublic boolean isTryNextMatch(ImmutableMap parameters)
isTryNextMatch
in interface RepeatableMatcher
parameters
- matching parameterspublic <T> void generateInlineTargets(DefaultGenerator generator, ResultHolder<T> result, ImmutableMap parameters)
InlineNode
RootNode
.
This method is used when sources of pattern have to be printedgenerateInlineTargets
in interface InlineNode
generator
- a to be used Generator
result
- holder of the resultparameters
- a ImmutableMap
with current parameterspublic TobeMatched matchTargets(TobeMatched targets, Matchers next)
matchTargets
in interface RootNode
targets
- to be matched target nodes and input parametersnext
- Chain of matchers which has to be processed after this RootNode
Copyright © 2007–2021 Inria. All rights reserved.