View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule42blockindentaion; //indent:0 exp:0
2   
3   import java.util.Map; //indent:0 exp:0
4   import java.util.ArrayList;//indent:0 exp:0
5   
6   public abstract class InputIndentationCorrect { //indent:0 exp:0
7   
8     static int i; //indent:2 exp:2
9   
10    int[] c = {1, 2, 3, //indent:2 exp:2
11        4, 5, 6}; //indent:6 exp:6
12  
13    int b; //indent:2 exp:2
14  
15    static { //indent:2 exp:2
16      i = 0; //indent:4 exp:4
17    } //indent:2 exp:2
18  
19    { //indent:2 exp:2
20      b = 2; //indent:4 exp:4
21    } //indent:2 exp:2
22  
23    private static abstract class RangesMatcher { //indent:2 exp:2
24  
25      private static final String ZEROES = "0\u0660\u06f0" //indent:4 exp:4
26          + "\u0c66\u0ce6" //indent:8 exp:8
27          + "\u1c40\u1c50"; //indent:8 exp:8
28  
29      public static final InputIndentationCorrect JAVA_LETTER_OR_DIGIT = //indent:4 exp:4
30          new InputIndentationCorrect() { //indent:8 exp:8
31            @Override public boolean matches(char c) { //indent:10 exp:10
32              return Character.isLetterOrDigit(c); //indent:12 exp:12
33            } //indent:10 exp:10
34          }; //indent:8 exp:8
35  
36      /** Matches no characters. */ //indent:4 exp:4
37      public static final InputFastMatcher NONE = //indent:4 exp:4
38              new InputFastMatcher() { //indent:12 exp:>=8
39        @Override public boolean matches(char c) { //indent:6 exp:6
40          return false; //indent:8 exp:8
41        } //indent:6 exp:6
42  
43        @Override public String replaceFrom(CharSequence sequence, CharSequence replacement) { //indent:6 exp:6
44          checkNotNull(replacement); //indent:8 exp:8
45          return sequence.toString(); //indent:8 exp:8
46        } //indent:6 exp:6
47  
48        private void checkNotNull(CharSequence replacement) {} //indent:6 exp:6
49  
50        @Override public String collapseFrom(CharSequence sequence, //indent:6 exp:6
51            char replacement) { //indent:10 exp:10
52          return sequence.toString(); //indent:8 exp:8
53        } //indent:6 exp:6
54  
55        @Override //indent:6 exp:6
56        public String trimTrailingFrom(CharSequence sequence) { //indent:6 exp:6
57          return sequence.toString(); //indent:8 exp:8
58        } //indent:6 exp:6
59      }; //indent:4 exp:4
60    } //indent:2 exp:2
61  
62    public boolean matches(char c) { //indent:2 exp:2
63      return false; //indent:4 exp:4
64    } //indent:2 exp:2
65  
66    public void foo() { //indent:2 exp:2
67      int i = 0; //indent:4 exp:4
68      for (; i < 9; i++) { //indent:4 exp:4
69        if (veryLongLongLongCondition() //indent:6 exp:6
70                || veryLongLongLongCondition2()) { //indent:14 exp:>=10
71          someFooMethod("longString", "veryLongString", //indent:8 exp:8
72              "superVeryExtraLongString"); //indent:12 exp:12
73          if (veryLongLongLongCondition()) { //indent:8 exp:8
74            while (veryLongLongLongCondition2() //indent:10 exp:10
75                  && veryLongLongLongCondition2()) { //indent:16 exp:>=14
76              try { //indent:12 exp:12
77                doSmth(); //indent:14 exp:14
78              } catch (Exception e) { //indent:12 exp:12
79                throw new AssertionError(e); //indent:14 exp:14
80              } //indent:12 exp:12
81            } //indent:10 exp:10
82          } //indent:8 exp:8
83        } //indent:6 exp:6
84      } //indent:4 exp:4
85    } //indent:2 exp:2
86  
87    public boolean veryLongLongLongCondition() { //indent:2 exp:2
88      if (veryLongLongLongCondition2()) { //indent:4 exp:4
89        return true; //indent:6 exp:6
90      } //indent:4 exp:4
91      return false; //indent:4 exp:4
92    } //indent:2 exp:2
93  
94    public boolean veryLongLongLongCondition2() { //indent:2 exp:2
95      return false; //indent:4 exp:4
96    } //indent:2 exp:2
97  
98    public void someFooMethod(String longString, //indent:2 exp:2
99        String superLongString, String exraSuperLongString) {} //indent:6 exp:6
100 
101   public void fooThrowMethod() //indent:2 exp:2
102           throws Exception { //indent:10 exp:>=6
103       /* Some code*/ //indent:6 exp:6
104   } //indent:2 exp:2
105 
106   public void doSmth() { //indent:2 exp:2
107     for (int h //indent:4 exp:4
108           : c) { //indent:10 exp:>=8
109       someFooMethod("longString", "veryLongString", //indent:6 exp:6
110           "superVeryExtraLongString"); //indent:10 exp:10
111     } //indent:4 exp:4
112   } //indent:2 exp:2
113 } //indent:0 exp:0