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: 18 | Number of AST nodes: 18 | |||
1 | if (this == Token.token_0to9)↵ | 1 | if (this == Token.token_not_0to9)↵ | |
2 | ret = "\\d";↵ | 2 | ret = "\\D";↵ | |
3 | else if (this == Token.token_wordchars)↵ | 3 | else if (this == Token.token_not_wordchars)↵ | |
4 | ret = "\\w";↵ | 4 | ret = "\\W";↵ | |
5 | else if (this == Token.token_spaces)↵ | 5 | else if (this == Token.token_not_spaces)↵ | |
6 | ret = "\\s";↵ | 6 | ret = "\\S";↵ | |
7 | else {↵ | 7 | else {↵ | |
8 | StringBuffer sb = new StringBuffer();↵ | 8 | StringBuffer sb = new StringBuffer();↵ | |
9 | sb.append("[");↵ | 9 | sb.append("[^");↵ | |
10 | for (int i = 0; i < this.ranges.length; i += 2) {↵ | 10 | for (int i = 0; i < this.ranges.length; i += 2) {↵ | |
11 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");↵ | 11 | if ((options & RegularExpression.SPECIAL_COMMA) != 0 && i > 0) sb.append(",");↵ | |
12 | if (this.ranges[i] == this.ranges[i+1]) {↵ | 12 | if (this.ranges[i] == this.ranges[i+1]) {↵ | |
13 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | 13 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | |
14 | } else {↵ | 14 | } else {↵ | |
15 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | 15 | sb.append(escapeCharInCharClass(this.ranges[i]));↵ | |
16 | sb.append('-');↵ | 16 | sb.append('-');↵ | |
17 | sb.append(escapeCharInCharClass(this.ranges[i+1]));↵ | 17 | sb.append(escapeCharInCharClass(this.ranges[i+1]));↵ | |
18 | }↵ | 18 | }↵ | |
19 | }↵ | 19 | }↵ | |
20 | sb.append("]");↵ | 20 | sb.append("]");↵ | |
21 | ret = sb.toString();↵ | 21 | ret = sb.toString();↵ | |
22 | } | 22 |
| |
See real code fragment | See real code fragment |
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) | 2.1 |
Clones location | Clones are in the same method |
Number of node comparisons | 116 |
Number of mapped statements | 18 |
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) | 9.4 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | if (this == Token.token_0to9) |
| 23 | if (this == Token.token_not_0to9) | ||||||||||
6 | ret = "\\d"; |
| 24 | ret = "\\D"; | ||||||||||
7 | else if (this == Token.token_wordchars) |
| 25 | else if (this == Token.token_not_wordchars) | ||||||||||
8 | ret = "\\w"; |
| 26 | ret = "\\W"; | ||||||||||
9 | else if (this == Token.token_spaces) |
| 27 | else if (this == Token.token_not_spaces) | ||||||||||
10 | ret = "\\s"; |
| 28 | ret = "\\S"; | ||||||||||
else | else | |||||||||||||
11 | StringBuffer sb = new StringBuffer(); | 29 | StringBuffer sb = new StringBuffer(); | |||||||||||
12 | sb.append("["); |
| 30 | sb.append("[^"); | ||||||||||
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 | sb.append(","); | 33 | sb.append(","); | |||||||||||
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])); | |||||||||||
else | else | |||||||||||||
18 | sb.append(escapeCharInCharClass(this.ranges[i])); | 36 | sb.append(escapeCharInCharClass(this.ranges[i])); | |||||||||||
19 | sb.append('-'); | 37 | sb.append('-'); | |||||||||||
20 | sb.append(escapeCharInCharClass(this.ranges[i + 1])); | 38 | sb.append(escapeCharInCharClass(this.ranges[i + 1])); | |||||||||||
21 | sb.append("]"); | 39 | sb.append("]"); | |||||||||||
22 | ret = sb.toString(); | 40 | ret = sb.toString(); |
Row | Violation |
---|