public class SwitchNode extends AbstractNode implements InlineNode
MATCH_ALL, MATCH_PART
Constructor and Description |
---|
SwitchNode() |
Modifier and Type | Method and Description |
---|---|
void |
addCase(PrimitiveMatcher vrOfExpression,
RootNode statement)
Adds another case into this switch statement
|
void |
forEachParameterInfo(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` |
TobeMatched |
matchTargets(TobeMatched targets,
Matchers nextMatchers) |
boolean |
replaceNode(RootNode oldNode,
RootNode newNode)
Call it to modify Pattern structure.
|
isSimplifyGenerated, setSimplifyGenerated, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isSimplifyGenerated, matchAllWith, 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 void addCase(PrimitiveMatcher vrOfExpression, RootNode statement)
vrOfExpression
- if value of this parameter is true then statement has to be used. If vrOfExpression is null, then statement is always usedstatement
- optional statementpublic <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 void forEachParameterInfo(BiConsumer<ParameterInfo,RootNode> consumer)
RootNode
ParameterInfo
) and RootNode
, which uses itforEachParameterInfo
in interface RootNode
consumer
- the receiver of pairs of ParameterInfo
and RootNode
public TobeMatched matchTargets(TobeMatched targets, Matchers nextMatchers)
matchTargets
in interface RootNode
targets
- to be matched target nodes and input parametersnextMatchers
- Chain of matchers which has to be processed after this RootNode
public <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 parametersCopyright © 2007–2019 Inria. All rights reserved.