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