1 package com.puppycrawl.tools.checkstyle.checks.indentation; 20 21 import com.puppycrawl.tools.checkstyle.api.DetailAST; 22 import com.puppycrawl.tools.checkstyle.api.TokenTypes; 23 24 29 public class CaseHandler extends ExpressionHandler 30 { 31 34 private final int[] mCaseChildren = new int[] { 35 TokenTypes.LITERAL_CASE, 36 TokenTypes.LITERAL_DEFAULT, 37 }; 38 39 47 public CaseHandler(IndentationCheck aIndentCheck, 48 DetailAST aExpr, ExpressionHandler aParent) 49 { 50 super(aIndentCheck, "case", aExpr, aParent); 51 } 52 53 58 protected IndentLevel getLevelImpl() 59 { 60 return new IndentLevel(getParent().getLevel(), 61 getIndentCheck().getCaseIndent()); 62 } 63 64 67 private void checkCase() 68 { 69 checkChildren(getMainAst(), mCaseChildren, getLevel(), true, false); 70 } 71 72 81 public IndentLevel suggestedChildLevel(ExpressionHandler aChild) 82 { 83 return getLevel(); 84 } 85 86 89 public void checkIndentation() 90 { 91 checkCase(); 92 } 93 } 94 | Popular Tags |