View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule4841indentation; //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:14 exp:14
40                  return false; //indent:16 exp:16
41                } //indent:14 exp:14
42  
43                @Override public String replaceFrom(CharSequence seq, //indent:14 exp:14
44                                                    CharSequence repl) { //indent:50 exp:50
45                  checkNotNull(repl); //indent:16 exp:16
46                  return seq.toString(); //indent:16 exp:16
47                } //indent:14 exp:14
48  
49                private void checkNotNull(CharSequence replacement) {} //indent:14 exp:14
50  
51                @Override public String collapseFrom(CharSequence sequence, //indent:14 exp:14
52                    char replacement) { //indent:18 exp:18
53                  return sequence.toString(); //indent:16 exp:16
54                } //indent:14 exp:14
55  
56                @Override //indent:14 exp:14
57                public String trimTrailingFrom(CharSequence sequence) { //indent:14 exp:14
58                  return sequence.toString(); //indent:16 exp:16
59                } //indent:14 exp:14
60              }; //indent:12 exp:12
61    } //indent:2 exp:2
62  
63    public boolean matches(char c) { //indent:2 exp:2
64      return false; //indent:4 exp:4
65    } //indent:2 exp:2
66  
67    public void foo() { //indent:2 exp:2
68      int i = 0; //indent:4 exp:4
69      for (; i < 9; i++) { //indent:4 exp:4
70        if (veryLongLongLongCondition() //indent:6 exp:6
71                || veryLongLongLongCondition2()) { //indent:14 exp:>=10
72          someFooMethod("longString", "veryLongString", //indent:8 exp:8
73              "superVeryExtraLongString"); //indent:12 exp:12
74          if (veryLongLongLongCondition()) { //indent:8 exp:8
75            while (veryLongLongLongCondition2() //indent:10 exp:10
76                  && veryLongLongLongCondition2()) { //indent:16 exp:>=14
77              try { //indent:12 exp:12
78                doSmth(); //indent:14 exp:14
79              } catch (Exception e) { //indent:12 exp:12
80                throw new AssertionError(e); //indent:14 exp:14
81              } //indent:12 exp:12
82            } //indent:10 exp:10
83          } //indent:8 exp:8
84        } //indent:6 exp:6
85      } //indent:4 exp:4
86    } //indent:2 exp:2
87  
88    public boolean veryLongLongLongCondition() { //indent:2 exp:2
89      if (veryLongLongLongCondition2()) { //indent:4 exp:4
90        return true; //indent:6 exp:6
91      } //indent:4 exp:4
92      return false; //indent:4 exp:4
93    } //indent:2 exp:2
94  
95    public boolean veryLongLongLongCondition2() { //indent:2 exp:2
96      return false; //indent:4 exp:4
97    } //indent:2 exp:2
98  
99    public void someFooMethod(String longString, //indent:2 exp:2
100       String superLongString, String exraSuperLongString) {} //indent:6 exp:6
101 
102   public void fooThrowMethod() //indent:2 exp:2
103           throws Exception { //indent:10 exp:>=6
104       /* Some code*/ //indent:6 exp:6
105   } //indent:2 exp:2
106 
107   public void doSmth() { //indent:2 exp:2
108     for (int h //indent:4 exp:4
109           : c) { //indent:10 exp:>=8
110       someFooMethod("longString", "veryLongString", //indent:6 exp:6
111           "superVeryExtraLongString"); //indent:10 exp:10
112     } //indent:4 exp:4
113   } //indent:2 exp:2
114 } //indent:0 exp:0