for (int i = 0; i < this.ranges.length; i += 2) {
if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");
if (this.ranges[i] == this.ranges[i+1]) {
sb.append(escapeCharInCharClass(this.ranges[i]));
} else {
sb.append(escapeCharInCharClass(this.ranges[i]));
sb.append('-');
sb.append(escapeCharInCharClass(this.ranges[i+1]));
}
}
for (int i = 0; i < this.ranges.length; i += 2) {
if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");
if (this.ranges[i] == this.ranges[i+1]) {
sb.append(escapeCharInCharClass(this.ranges[i]));
} else {
sb.append(escapeCharInCharClass(this.ranges[i]));
sb.append('-');
sb.append(escapeCharInCharClass(this.ranges[i+1]));
}
}
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
|
|
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xml/type/internal/RegEx.java
|
Method name: String toString(int)
|
|
Method name: String toString(int)
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | for (int i = 0; i < this.ranges.length; i += 2) {↵ | | 1 | for (int i = 0; i < this.ranges.length; i += 2) {↵
|
2 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");↵ | | 2 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");↵
|
3 | if (this.ranges[i] == this.ranges[i+1]) {↵ | | 3 | if (this.ranges[i] == this.ranges[i+1]) {↵
|
4 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | | 4 | sb.append(escapeCharInCharClass(this.ranges[i]));↵
|
5 | } else {↵ | | 5 | } else {↵
|
6 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | | 6 | sb.append(escapeCharInCharClass(this.ranges[i]));↵
|
7 | sb.append('-');↵ | | 7 | sb.append('-');↵
|
8 | sb.append(escapeCharInCharClass(this.ranges[i+1]));↵ | | 8 | sb.append(escapeCharInCharClass(this.ranges[i+1]));↵
|
9 | }↵ | | 9 | }↵
|
10 | } | | 10 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.8 |
Clones location | Clones are in the same method |
Number of node comparisons | 42 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 8 |
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 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
13 | for (int i = 0; i < this.ranges.length; i += 2) | | 31 | for (int i = 0; i < this.ranges.length; i += 2) |
14 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) | | 32 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) |
15 | | | 33 | |
16 | if (this.ranges[i] == this.ranges[i + 1]) | | 34 | if (this.ranges[i] == this.ranges[i + 1]) |
17 | sb.append(escapeCharInCharClass(this.ranges[i])); | | 35 | sb.append(escapeCharInCharClass(this.ranges[i])); |
| | | | |
18 | sb.append(escapeCharInCharClass(this.ranges[i])); | | 36 | sb.append(escapeCharInCharClass(this.ranges[i])); |
19 | | | 37 | |
20 | sb.append(escapeCharInCharClass(this.ranges[i + 1])); | | 38 | sb.append(escapeCharInCharClass(this.ranges[i + 1])); |
Precondition Violations (0)
Row |
Violation |