@Override public boolean matches(final INode other, final Match match) { if (other instanceof SwitchStatement) { final SwitchStatement otherStatement = (SwitchStatement) other; return !otherStatement.isNull() && getExpression().matches(otherStatement.getExpression(), match) && getSwitchSections().matches(otherStatement.getSwitchSections(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof SwitchStatement) { final SwitchStatement otherStatement = (SwitchStatement) other; return !otherStatement.isNull() && getExpression().matches(otherStatement.getExpression(), match) && getSwitchSections().matches(otherStatement.getSwitchSections(), match); } return false; } }
@Override public boolean matches(final INode other, final Match match) { if (other instanceof SwitchStatement) { final SwitchStatement otherStatement = (SwitchStatement) other; return !otherStatement.isNull() && getExpression().matches(otherStatement.getExpression(), match) && getSwitchSections().matches(otherStatement.getSwitchSections(), match); } return false; } }
private boolean rewriteSwitch(final SwitchStatement s, final Map<Integer, Expression> mappings) { final Map<Expression, Expression> replacements = new IdentityHashMap<>(); for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
private boolean rewriteSwitch(final SwitchStatement s, final Map<Integer, Expression> mappings) { final Map<Expression, Expression> replacements = new IdentityHashMap<>(); for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
private boolean rewriteSwitch(final SwitchStatement s, final Map<Integer, Expression> mappings) { final Map<Expression, Expression> replacements = new IdentityHashMap<>(); for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
for (final SwitchSection section : s.getSwitchSections()) { for (final CaseLabel caseLabel : section.getCaseLabels()) { final Expression expression = caseLabel.getExpression();
SwitchSection sectionMatchedByConstant = null; for (final SwitchSection section : node.getSwitchSections()) { for (final CaseLabel label : section.getCaseLabels()) { if (label.getExpression().isNull()) { for (final SwitchSection section : node.getSwitchSections()) { assert section != null;
SwitchSection sectionMatchedByConstant = null; for (final SwitchSection section : node.getSwitchSections()) { for (final CaseLabel label : section.getCaseLabels()) { if (label.getExpression().isNull()) { for (final SwitchSection section : node.getSwitchSections()) { assert section != null;
SwitchSection sectionMatchedByConstant = null; for (final SwitchSection section : node.getSwitchSections()) { for (final CaseLabel label : section.getCaseLabels()) { if (label.getExpression().isNull()) { for (final SwitchSection section : node.getSwitchSections()) { assert section != null;
for (final SwitchSection section : node.getSwitchSections()) { final Match m3 = CASE_BODY_PATTERN.match(section.getStatements().firstOrNullObject()); tableSwitch.getSwitchSections(), new Predicate<SwitchSection>() { @Override tableSwitch.getExpression().replaceWith(newInput); for (final SwitchSection s : tableSwitch.getSwitchSections()) { for (final CaseLabel c : s.getCaseLabels()) { if (c.getExpression() == null || c.getExpression().isNull()) {
final AstNodeCollection<SwitchSection> sections = node.getSwitchSections();
@Override public Void visitSwitchStatement(final SwitchStatement node, final Void ignored) { startNode(node); writeKeyword(SwitchStatement.SWITCH_KEYWORD_ROLE); space(policy.SpaceBeforeSwitchParentheses); leftParenthesis(); space(policy.SpacesWithinSwitchParentheses); node.getExpression().acceptVisitor(this, ignored); space(policy.SpacesWithinSwitchParentheses); rightParenthesis(); openBrace(policy.StatementBraceStyle); if (policy.IndentSwitchBody) { formatter.indent(); } for (final SwitchSection section : node.getSwitchSections()) { section.acceptVisitor(this, ignored); } if (policy.IndentSwitchBody) { formatter.unindent(); } closeBrace(policy.StatementBraceStyle); newLine(); endNode(node); return null; }
@Override public Void visitSwitchStatement(final SwitchStatement node, final Void ignored) { startNode(node); writeKeyword(SwitchStatement.SWITCH_KEYWORD_ROLE); space(policy.SpaceBeforeSwitchParentheses); leftParenthesis(); space(policy.SpacesWithinSwitchParentheses); node.getExpression().acceptVisitor(this, ignored); space(policy.SpacesWithinSwitchParentheses); rightParenthesis(); openBrace(policy.StatementBraceStyle); if (policy.IndentSwitchBody) { formatter.indent(); } for (final SwitchSection section : node.getSwitchSections()) { section.acceptVisitor(this, ignored); } if (policy.IndentSwitchBody) { formatter.unindent(); } closeBrace(policy.StatementBraceStyle); newLine(); endNode(node); return null; }
final AstNodeCollection<SwitchSection> sections = node.getSwitchSections();
@Override public Void visitSwitchStatement(final SwitchStatement node, final Void ignored) { startNode(node); writeKeyword(SwitchStatement.SWITCH_KEYWORD_ROLE); space(policy.SpaceBeforeSwitchParentheses); leftParenthesis(); space(policy.SpacesWithinSwitchParentheses); node.getExpression().acceptVisitor(this, ignored); space(policy.SpacesWithinSwitchParentheses); rightParenthesis(); openBrace(policy.StatementBraceStyle); if (policy.IndentSwitchBody) { formatter.indent(); } for (final SwitchSection section : node.getSwitchSections()) { section.acceptVisitor(this, ignored); } if (policy.IndentSwitchBody) { formatter.unindent(); } closeBrace(policy.StatementBraceStyle); newLine(); endNode(node); return null; }
final AstNodeCollection<SwitchSection> sections = node.getSwitchSections();
switchStatement.getSwitchSections().add(section);