File path: /jEdit-4.2/src/org/gjt/sp/jedit/TextUtilities.java | File path: /jEdit-4.2/src/org/gjt/sp/jedit/TextUtilities.java | |||
Method name: int findWordStart(String, int, String, boolean, boolean)
|
Method name: int findWordEnd(String, int, String, boolean, boolean)
|
|||
Number of AST nodes: 24 | Number of AST nodes: 24 | |||
1 | ch = line.charAt(i);↵ | 1 | ch = line.charAt(i);↵ | |
2 | switch(type)↵ | 2 | switch(type)↵ | |
3 | {↵ | 3 | {↵ | |
4 | //{{{ Whitespace...↵ | 4 | //{{{ Whitespace...↵ | |
5 | case WHITESPACE:↵ | 5 | case WHITESPACE:↵ | |
6 | // only select other whitespace in this case↵ | 6 | // only select other whitespace in this case↵ | |
7 | if(Character.isWhitespace(ch))↵ | 7 | if(Character.isWhitespace(ch))↵ | |
8 | break;↵ | 8 | break;↵ | |
9 | // word char or symbol; stop↵ | 9 | ↵ | |
10 | else↵ | 10 | else↵ | |
11 | return i + 1; //}}}↵ | 11 | return i; //}}}↵ | |
12 | //{{{ Word character...↵ | 12 | //{{{ Word character...↵ | |
13 | case WORD_CHAR:↵ | 13 | case WORD_CHAR:↵ | |
14 | // word char; keep going↵ | 14 | ↵ | |
15 | if(Character.isLetterOrDigit(ch) ||↵ | 15 | if(Character.isLetterOrDigit(ch) ||↵ | |
16 | noWordSep.indexOf(ch) != -1)↵ | 16 | noWordSep.indexOf(ch) != -1)↵ | |
17 | {↵ | 17 | {↵ | |
18 | break;↵ | 18 | break;↵ | |
19 | }↵ | 19 | }↵ | |
20 | // whitespace; include in word if eating↵ | 20 | // whitespace; include in word if eating↵ | |
21 | else if(Character.isWhitespace(ch)↵ | 21 | else if(Character.isWhitespace(ch)↵ | |
22 | && eatWhitespace)↵ | 22 | && eatWhitespace)↵ | |
23 | {↵ | 23 | {↵ | |
24 | type = WHITESPACE;↵ | 24 | type = WHITESPACE;↵ | |
25 | break;↵ | 25 | break;↵ | |
26 | }↵ | 26 | }↵ | |
27 | else↵ | 27 | else↵ | |
28 | return i + 1; //}}}↵ | 28 | return i; //}}}↵ | |
29 | //{{{ Symbol...↵ | 29 | //{{{ Symbol...↵ | |
30 | case SYMBOL:↵ | 30 | case SYMBOL:↵ | |
31 | if(!joinNonWordChars && pos != i)↵ | 31 | if(!joinNonWordChars && i != pos)↵ | |
32 | return i + 1;↵ | 32 | return i;↵ | |
33 | // whitespace; include in word if eating↵ | 33 | // if we see whitespace, set flag.↵ | |
34 | if(Character.isWhitespace(ch))↵ | 34 | if(Character.isWhitespace(ch))↵ | |
35 | {↵ | 35 | {↵ | |
36 | if(eatWhitespace)↵ | 36 | if(eatWhitespace)↵ | |
37 | {↵ | 37 | {↵ | |
38 | type = WHITESPACE;↵ | 38 | type = WHITESPACE;↵ | |
39 | break;↵ | 39 | break;↵ | |
40 | }↵ | 40 | }↵ | |
41 | else↵ | 41 | else↵ | |
42 | return i + 1;↵ | 42 | return i;↵ | |
43 | }↵ | 43 | }↵ | |
44 | else if(Character.isLetterOrDigit(ch) ||↵ | 44 | else if(Character.isLetterOrDigit(ch) ||↵ | |
45 | noWordSep.indexOf(ch) != -1)↵ | 45 | noWordSep.indexOf(ch) != -1)↵ | |
46 | {↵ | 46 | {↵ | |
47 | return i + 1;↵ | 47 | return i;↵ | |
48 | }↵ | 48 | }↵ | |
49 | else↵ | 49 | else↵ | |
50 | {↵ | 50 | {↵ | |
51 | break;↵ | 51 | break;↵ | |
52 | } //}}}↵ | 52 | } //}}}↵ | |
53 | } | 53 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 4.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 104 |
Number of mapped statements | 24 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 11.3 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
11 | ch = line.charAt(i); | 13 | ch = line.charAt(i); | ||||||||||||||
12 | switch (type) | 14 | switch (type) | ||||||||||||||
13 | case WHITESPACE: | 15 | case WHITESPACE: | ||||||||||||||
14 | if (Character.isWhitespace(ch)) | 16 | if (Character.isWhitespace(ch)) | ||||||||||||||
15 | break; | 17 | break; | ||||||||||||||
else | else | ||||||||||||||||
16 | return i + 1; |
| 18 | return i; | |||||||||||||
17 | case WORD_CHAR: | 19 | case WORD_CHAR: | ||||||||||||||
18 | if (Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) | 20 | if (Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) | ||||||||||||||
19 | break; | 21 | break; | ||||||||||||||
20 | else if (Character.isWhitespace(ch) && eatWhitespace) | 22 | else if (Character.isWhitespace(ch) && eatWhitespace) | ||||||||||||||
21 | type = WHITESPACE; | 23 | type = WHITESPACE; | ||||||||||||||
22 | break; | 24 | break; | ||||||||||||||
else | else | ||||||||||||||||
23 | return i + 1; |
| 25 | return i; | |||||||||||||
24 | case SYMBOL: | 26 | case SYMBOL: | ||||||||||||||
25 | if (!joinNonWordChars && pos != i) |
| 27 | if (!joinNonWordChars && i != pos) | |||||||||||||
26 | return i + 1; |
| 28 | return i; | |||||||||||||
27 | if (Character.isWhitespace(ch)) | 29 | if (Character.isWhitespace(ch)) | ||||||||||||||
28 | if (eatWhitespace) | 30 | if (eatWhitespace) | ||||||||||||||
29 | type = WHITESPACE; | 31 | type = WHITESPACE; | ||||||||||||||
30 | break; | 32 | break; | ||||||||||||||
else | else | ||||||||||||||||
31 | return i + 1; |
| 33 | return i; | |||||||||||||
32 | else if (Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) | 34 | else if (Character.isLetterOrDigit(ch) || noWordSep.indexOf(ch) != -1) | ||||||||||||||
33 | return i + 1; |
| 35 | return i; | |||||||||||||
else | else | ||||||||||||||||
34 | break; | 36 | break; |
Row | Violation |
---|---|
1 | Expression i + 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Not all possible execution flows end in a return statement |