if (isHexChar(c)) {
for (;; c = src.read()) {
if (c == '_') {
if (nondigit != '\0') break;
nondigit = c;
} else if (isHexChar(c)) {
nondigit = '\0';
tokenBuffer.append((char) c);
} else {
break;
}
}
}
if (Character.isDigit(c)) {
for (;; c = src.read()) {
if (c == '_') {
if (nondigit != '\0') break;
nondigit = c;
} else if (Character.isDigit(c)) {
nondigit = '\0';
tokenBuffer.append((char) c);
} else {
break;
}
}
}
Clone fragments detected by clone detection tool
File path: /jruby-1.4.0/src/org/jruby/lexer/yacc/RubyYaccLexer.java
|
|
File path: /jruby-1.4.0/src/org/jruby/lexer/yacc/RubyYaccLexer.java
|
Method name: int parseNumber(int)
|
|
Method name: int parseNumber(int)
|
Number of AST nodes: 10
|
|
Number of AST nodes: 10
|
|
1 | if (isHexChar(c)) {↵ | | 1 | if (Character.isDigit(c)) {↵
|
2 | for (;; c = src.read()) {↵ | | 2 | for (;; c = src.read()) {↵
|
3 | if (c == '_') {↵ | | 3 | if (c == '_') {↵
|
4 | if (nondigit != '\0') break;↵ | | 4 | if (nondigit != '\0') break;↵
|
5 | nondigit = c;↵ | | 5 | nondigit = c;↵
|
6 | } else if (isHexChar(c)) {↵ | | 6 | } else if (Character.isDigit(c)) {↵
|
7 | nondigit = '\0';↵ | | 7 | nondigit = '\0';↵
|
8 | tokenBuffer.append((char) c);↵ | | 8 | tokenBuffer.append((char) c);↵
|
9 | } else {↵ | | 9 | } else {↵
|
10 | break;↵ | | 10 | break;↵
|
11 | }↵ | | 11 | }↵
|
12 | }↵ | | 12 | }↵
|
13 | } | | 13 | }
|
See real code fragment |
|
See real code fragment |
Summary
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) | 0.5 |
Clones location | Clones are in the same method |
Number of node comparisons | 27 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 10 |
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) | 56.9 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
15 | if (isHexChar(c)) | | 55 | if (Character.isDigit(c)) |
16 | | | 56 | |
17 | | | 57 | |
18 | | | 58 | |
19 | | | 59 | |
20 | | | 60 | |
21 | | | 61 | else if (Character.isDigit(c)) |
22 | | | 62 | |
23 | tokenBuffer.append((char)c); | | 63 | tokenBuffer.append((char)c); |
| | | | |
24 | | | 64 | |
Precondition Violations (5)
Row |
Violation |
1 | Expression isHexChar(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression Character.isDigit(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression isHexChar(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression Character.isDigit(c) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Clone fragment #1 returns variables c, nondigit , while Clone fragment #2 returns variables c, nondigit |