File path: /jEdit-4.2/src/gnu/regexp/RETokenRepeated.java | File path: /jEdit-4.2/src/gnu/regexp/RETokenRepeated.java | |||
Method name: boolean match(CharIndexed, REMatch)
|
Method name: REMatch matchRest(CharIndexed, REMatch)
|
|||
Number of AST nodes: 10 | Number of AST nodes: 9 | |||
1 | while (--posIndex >= min) {↵ | |||
2 | newMatch = (REMatch) positions.elementAt(posIndex);↵ | |||
3 | results = matchRest(input, newMatch);↵ | |||
4 | if (results != null) {↵ | |||
5 | if (allResults↵ | 1 | for (current = newMatch; current != null; current = current.next) {↵ | |
2 | // clone() separates a single match from the chain↵ | |||
3 | single = (REMatch) current.clone();↵ | |||
4 | if (next(input, single)) {↵ | |||
5 | // chain results to doneIndex↵ | |||
6 | == null) {↵ | 6 | if (doneIndex == null) {↵ | |
7 | allResults = results;↵ | 7 | ↵ | |
8 | allResultsLast = results;↵ | |||
9 | } else {↵ | |||
10 | // Order these from longest to shortest↵ | |||
11 | // Start by assuming longest (more repeats)↵ | |||
12 | allResults↵ | 8 | doneIndex = single;↵ | |
9 | doneIndexLast = single;↵ | |||
10 | } else {↵ | |||
13 | Last.next = results;↵ | 11 | doneIndexLast.next = single;↵ | |
14 | }↵ | 12 | }↵ | |
15 | // Find new doablesLast↵ | 13 | // Find new doneIndexLast↵ | |
16 | while (allResultsLast.next != null) {↵ | 14 | while (doneIndexLast.next != null) {↵ | |
17 | allResultsLast = allResultsLast.next;↵ | 15 | ↵ | |
18 | }↵ | |||
19 | }↵ | |||
20 | // else did not match rest of the tokens, try again on smaller sample↵ | 16 | doneIndexLast = doneIndexLast.next;↵ | |
17 | }↵ | |||
18 | }↵ | |||
21 | } | 19 |
| |
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) | 1.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 33 |
Number of mapped statements | 6 |
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) | 4.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
42 | if (allResults == null) |
| 7 | if (doneIndex == null) | |||||||||||||
43 | allResults = results; |
| 8 | doneIndex = single; | |||||||||||||
44 | allResultsLast = results; |
| 9 | doneIndexLast = single; | |||||||||||||
else | else | ||||||||||||||||
45 | allResultsLast.next = results; |
| 10 | doneIndexLast.next = single; | |||||||||||||
46 | while (allResultsLast.next != null) |
| 11 | while (doneIndexLast.next != null) | |||||||||||||
47 | allResultsLast = allResultsLast.next; |
| 12 | doneIndexLast = doneIndexLast.next; |
Row | Violation |
---|---|
1 | Clone fragment #1 returns variables allResults, allResultsLast , while Clone fragment #2 returns variables doneIndex, doneIndexLast |