if (position + n <= document.getLength())
{
position += n;
return n;
}
else
{
long oldPos = position;
position = document.getLength();
return (document.getLength() - oldPos);
}
if (position + n <= document.getLength())
{
position += n;
return n;
}
else
{
long oldPos = position;
position = document.getLength();
return (document.getLength() - oldPos);
}
Clone fragments detected by clone detection tool
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/oster/OsterTextControl.java
|
|
File path: /sql12/plugins/syntax/src/net/sourceforge/squirrel_sql/plugins/syntax/oster/DocReader.java
|
Method name: long skip(long)
|
|
Method name: long skip(long)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (position + n <= document.getLength())↵ | | 1 | if (position + n <= document.getLength())
↵
|
2 | {↵ | | 2 | {
↵
|
3 | position += n;↵ | | 3 | position += n;
↵
|
4 | return n;↵ | | 4 | return n;
↵
|
5 | }↵ | | 5 | }
↵
|
6 | else↵ | | 6 | else
↵
|
7 | {↵ | | 7 | {
↵
|
8 | long oldPos = position;↵ | | 8 | long oldPos = position;
↵
|
9 | position = document.getLength();↵ | | 9 | position = document.getLength();
↵
|
10 | return (document.getLength() - oldPos);↵ | | 10 | return (document.getLength() - oldPos);
↵
|
11 | } | | 11 | }
|
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.2 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 36 |
-
{Refactorable}
Mapping Summary
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) | 1.6 |
Clone type | Type 1 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
1 | if (position + n <= document.getLength()) | | 1 | if (position + n <= document.getLength()) |
2 | | | 2 | |
3 | | | 3 | |
| | | | |
4 | | | 4 | |
5 | position = document.getLength(); | | 5 | position = document.getLength(); |
6 | return (document.getLength() - oldPos); | | 6 | return (document.getLength() - oldPos); |
Precondition Violations (0)
Row |
Violation |