View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule42blockindentaion; //indent:0 exp:0
2   
3   class FooWhileClass { //indent:0 exp:0
4   
5     String getString(int someInt, String someString) { //indent:2 exp:2
6       return "String"; //indent:4 exp:4
7     } //indent:2 exp:2
8   
9     void fooMethodWithIf() { //indent:2 exp:2
10  
11      while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4
12          SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:8 exp:8
13             getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:11 exp:>=8
14            new InnerClassFoo())) {} //indent:10 exp:>=8
15  
16      do { //indent:4 exp:4
17  
18      } while (conditionFirst("Loooooooooooooooooong", new //indent:4 exp:4
19           SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:9 exp:>=8
20                 getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:15 exp:>=8
21           new InnerClassFoo())); //indent:9 exp:>=8
22  
23      while (conditionSecond(10000000000.0, new //indent:4 exp:4
24           SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:9 exp:>=8
25          + "oooooooooooong").getString(new FooWhileClass(), //indent:8 exp:8
26             new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:11 exp:>=8
27          getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:8 exp:8
28                || conditionThird(2048) || conditionFourth(new //indent:14 exp:>=8
29                SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:14 exp:>=8
30          + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8
31              conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName( //indent:12 exp:>=8
32              getString(2048, "Looo" //indent:12 exp:>=8
33          + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8
34          new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8
35             SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:11 exp:>=8
36          + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8
37            || conditionNoArg() || //indent:10 exp:>=8
38            conditionNoArg() || conditionNoArg()) {} //indent:10 exp:10
39  
40      do { //indent:4 exp:4
41  
42      } while (conditionSecond(10000000000.0, new //indent:4 exp:4
43            SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:10 exp:>=8
44            + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:>=8
45          new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:8 exp:8
46               getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:13 exp:>=8
47          || conditionThird(2048) || conditionFourth(new //indent:8 exp:8
48             SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:11 exp:>=8
49          + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:8 exp:8
50          conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName(getString(2048, "Looo" //indent:8 exp:8
51          + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:8 exp:8
52          new FooWhileClass(), true)) || conditionSixth(false, new //indent:8 exp:8
53             SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:11 exp:>=8
54          + "Fooooooo><"))) || conditionNoArg() //indent:8 exp:8
55               || conditionNoArg() || //indent:13 exp:>=8
56          conditionNoArg() || conditionNoArg()); //indent:8 exp:8
57    } //indent:2 exp:2
58  
59    private boolean conditionFirst(String longString, int //indent:2 exp:2
60        integer, InnerClassFoo someInstance) { //indent:6 exp:6
61      return false; //indent:4 exp:4
62    } //indent:2 exp:2
63  
64    private boolean conditionSecond(double longLongLongDoubleValue, //indent:2 exp:2
65        String longLongLongString, String secondLongLongString) { //indent:6 exp:6
66      return false; //indent:4 exp:4
67    } //indent:2 exp:2
68  
69    private boolean conditionThird(long veryLongValue) { //indent:2 exp:2
70      return false; //indent:4 exp:4
71    } //indent:2 exp:2
72  
73    private boolean conditionFourth(boolean flag) { //indent:2 exp:2
74      return false; //indent:4 exp:4
75    } //indent:2 exp:2
76  
77    private boolean conditionFifth(boolean flag1, boolean flag2) { //indent:2 exp:2
78      return false; //indent:4 exp:4
79    } //indent:2 exp:2
80  
81    private boolean conditionSixth(boolean flag, //indent:2 exp:2
82        SecondWhileClassWithVeryVeryVeryLongName instance) { //indent:6 exp:6
83      return false; //indent:4 exp:4
84    } //indent:2 exp:2
85  
86    private boolean conditionNoArg() { //indent:2 exp:2
87      return false; //indent:4 exp:4
88    } //indent:2 exp:2
89  
90    class InnerClassFoo { //indent:2 exp:2
91  
92      void fooMethodWithIf() { //indent:4 exp:4
93        while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6
94            SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:10 exp:10
95                getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10
96                new InnerClassFoo())) {} //indent:14 exp:>=10
97  
98        do { //indent:6 exp:6
99          /* Do somethig*/ //indent:8 exp:8
100       } while (conditionFirst("Loooooooooooooooooong", new //indent:6 exp:6
101           SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:10 exp:10
102               getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:14 exp:>=10
103               new InnerClassFoo())); //indent:14 exp:>=10
104 
105       while (conditionSecond(10000000000.0, new //indent:6 exp:6
106           SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:10 exp:10
107           + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10
108           new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:10 exp:10
109           getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:10 exp:10
110           || conditionThird(2048) || conditionFourth(new //indent:10 exp:10
111           SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:10 exp:10
112             + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10
113             conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName(getString(2048, "Looo" //indent:12 exp:>=10
114             + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10
115             new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10
116               SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:14 exp:>=10
117               + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10
118               || conditionNoArg() || //indent:14 exp:>=10
119               conditionNoArg() || conditionNoArg()) {} //indent:14 exp:>=10
120 
121       do { //indent:6 exp:6
122     	/* Do smth*/ //indent:8 exp:8
123       } while (conditionSecond(10000000000.0, new //indent:6 exp:6
124           SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:10 exp:10
125           + "oooooooooooong").getString(new FooWhileClass(), //indent:10 exp:10
126           new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:10 exp:10
127           getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:10 exp:10
128           || conditionThird(2048) || conditionFourth(new //indent:10 exp:10
129           SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:10 exp:10
130             + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:12 exp:>=10
131             conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName(getString(2048, "Looo" //indent:12 exp:>=10
132             + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:12 exp:>=10
133             new FooWhileClass(), true)) || conditionSixth(false, new //indent:12 exp:>=10
134               SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:14 exp:>=10
135               + "Fooooooo><"))) || conditionNoArg() //indent:14 exp:>=10
136               || conditionNoArg() || //indent:14 exp:>=10
137               conditionNoArg() || conditionNoArg()); //indent:14 exp:>=10
138     } //indent:4 exp:4
139 
140     FooWhileClass anonymousClass = new FooWhileClass() { //indent:4 exp:4
141 
142       void fooMethodWithIf(String stringStringStringStringLooooongString, //indent:6 exp:6
143           int intIntIntVeryLongNameForIntVariable, boolean //indent:10 exp:10
144               fooooooooobooleanBooleanVeryLongName) { //indent:14 exp:>=10
145 
146         while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8
147             SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:12 exp:12
148                 getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12
149                    new InnerClassFoo())) {} //indent:19 exp:>=12
150 
151         do { //indent:8 exp:8
152           /* Do smth*/ //indent:10 exp:10
153         } while (conditionFirst("Loooooooooooooooooong", new //indent:8 exp:8
154             SecondWhileClassWithVeryVeryVeryLongName("Loooooooooooooooooog"). //indent:12 exp:12
155                 getInteger(new FooWhileClass(), "Loooooooooooooooooog"), //indent:16 exp:>=12
156                    new InnerClassFoo())); //indent:19 exp:>=12
157 
158         while (conditionSecond(10000000000.0, new //indent:8 exp:8
159             SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:12 exp:12
160             + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12
161             new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:12 exp:12
162             getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:12 exp:12
163             || conditionThird(2048) || conditionFourth(new //indent:12 exp:12
164             SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:12 exp:12
165               + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12
166               conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName(getString(2048, "Looo" //indent:14 exp:>=12
167               + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12
168               new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12
169                 SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:16 exp:>=12
170                 + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12
171                 || conditionNoArg() || //indent:16 exp:>=12
172                   conditionNoArg() || conditionNoArg() //indent:18 exp:>=12
173                      && fooooooooobooleanBooleanVeryLongName) {} //indent:21 exp:>=12
174 
175         do { //indent:8 exp:8
176           /* Do smth*/ //indent:10 exp:10
177         } while (conditionSecond(10000000000.0, new //indent:8 exp:8
178             SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooo" //indent:12 exp:12
179             + "oooooooooooong").getString(new FooWhileClass(), //indent:12 exp:12
180             new SecondWhileClassWithVeryVeryVeryLongName("loooooooooong"). //indent:12 exp:12
181             getInteger(new FooWhileClass(), "loooooooooooooong")), "loooooooooooong") //indent:12 exp:12
182             || conditionThird(2048) || conditionFourth(new //indent:12 exp:12
183             SecondWhileClassWithVeryVeryVeryLongName("Looooooooooooooo" //indent:12 exp:12
184               + "ooooooooooooong").getBoolean(new FooWhileClass(), false)) || //indent:14 exp:>=12
185               conditionFifth(true, new SecondWhileClassWithVeryVeryVeryLongName(getString(2048, "Looo" //indent:14 exp:>=12
186               + "ooooooooooooooooooooooooooooooooooooooooooong")).getBoolean( //indent:14 exp:>=12
187               new FooWhileClass(), true)) || conditionSixth(false, new //indent:14 exp:>=12
188                 SecondWhileClassWithVeryVeryVeryLongName(getString(100000, "Loooooong" //indent:16 exp:>=12
189                 + "Fooooooo><"))) || conditionNoArg() //indent:16 exp:>=12
190                 || conditionNoArg() || //indent:16 exp:>=12
191                   conditionNoArg() || conditionNoArg() //indent:18 exp:>=12
192                      && fooooooooobooleanBooleanVeryLongName);//indent:21 exp:>=12
193       } //indent:6 exp:6
194     }; //indent:4 exp:4
195   } //indent:2 exp:2
196 } //indent:0 exp:0
197 
198 class SecondWhileClassWithVeryVeryVeryLongName { //indent:0 exp:0
199 
200   public SecondWhileClassWithVeryVeryVeryLongName(String string) { //indent:2 exp:2
201 
202   } //indent:2 exp:2
203 
204   String getString(FooWhileClass instance, int integer) { //indent:2 exp:2
205     return "String"; //indent:4 exp:4
206   } //indent:2 exp:2
207 
208   int getInteger(FooWhileClass instance, String string) { //indent:2 exp:2
209     return -1;   //indent:4 exp:4
210   } //indent:2 exp:2
211 
212   boolean getBoolean(FooWhileClass instance, boolean flag) { //indent:2 exp:2
213     return false; //indent:4 exp:4
214   } //indent:2 exp:2
215 
216   SecondWhileClassWithVeryVeryVeryLongName getInstanse() { //indent:2 exp:2
217     return new SecondWhileClassWithVeryVeryVeryLongName("VeryLoooooooooo" //indent:4 exp:4
218         + "oongString"); //indent:8 exp:8
219   } //indent:2 exp:2
220 } //indent:0 exp:0