if (!getInitialized()) {
initialize();
setInitialized(true);
}
while (line == null || line.length() == 0) {
line = lineTokenizer.getToken(in);
if (line == null) {
return -1;
}
line = headFilter(line);
linePos = 0;
}
int ch = line.charAt(linePos);
linePos++;
if (linePos == line.length()) {
line = null;
}
return ch;
if (!getInitialized()) {
initialize();
setInitialized(true);
}
while (line == null || line.length() == 0) {
line = lineTokenizer.getToken(in);
line = tailFilter(line);
if (line == null) {
return -1;
}
linePos = 0;
}
int ch = line.charAt(linePos);
linePos++;
if (linePos == line.length()) {
line = null;
}
return ch;
Clone fragments detected by clone detection tool
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/HeadFilter.java
|
|
File path: /apache-ant-1.7.0/src/org/apache/tools/ant/filters/TailFilter.java
|
Method name: int read()
|
|
Method name: int read()
|
Number of AST nodes: 14
|
|
Number of AST nodes: 14
|
|
1 | if (!getInitialized()) {↵ | | 1 | if (!getInitialized()) {↵
|
2 | initialize();↵ | | 2 | initialize();↵
|
3 | setInitialized(true);↵ | | 3 | setInitialized(true);↵
|
4 | }↵ | | 4 | }↵
|
|
5 | while (line == null || line.length() == 0) {↵ | | 5 | while (line == null || line.length() == 0) {↵
|
6 | line = lineTokenizer.getToken(in);↵ | | 6 | line = lineTokenizer.getToken(in);↵
|
| | | 7 | line = tailFilter(line);↵
|
7 | if (line == null) {↵ | | 8 | if (line == null) {↵
|
8 | return -1;↵ | | 9 | return -1;↵
|
9 | }↵ | | 10 | }↵
|
10 | line = headFilter(line);↵ | | |
|
11 | linePos = 0;↵ | | 11 | linePos = 0;↵
|
12 | }↵ | | 12 | }↵
|
|
13 | int ch = line.charAt(linePos);↵ | | 13 | int ch = line.charAt(linePos);↵
|
14 | linePos++;↵ | | 14 | linePos++;↵
|
15 | if (linePos == line.length()) {↵ | | 15 | if (linePos == line.length()) {↵
|
16 | line = null;↵ | | 16 | line = null;↵
|
17 | }↵ | | 17 | }↵
|
18 | return ch; | | 18 | return ch;
|
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.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 45 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 14 |
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) | 3.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (!getInitialized()) | | 1 | if (!getInitialized()) |
2 | | | 2 | |
3 | | | 3 | |
4 | while (line == null || line.length() == 0) | | 4 | while (line == null || line.length() == 0) |
5 | line = lineTokenizer.getToken(in); | | 5 | line = lineTokenizer.getToken(in); |
6 | | | 7 | |
7 | | | 8 | |
8 | | | 6 | |
9 | | | 9 | |
10 | int ch = line.charAt(linePos); | | 10 | int ch = line.charAt(linePos); |
11 | linePos++; | | 11 | linePos++; |
12 | if (linePos == line.length()) | | 12 | if (linePos == line.length()) |
13 | | | 13 | |
14 | return ch; | | 14 | return ch; |
Precondition Violations (2)
Row |
Violation |
1 | Expression headFilter(line) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression tailFilter(line) cannot be parameterized, because it has dependencies to/from statements that will be extracted |