logicalLength += tabSize - (logicalLength % tabSize);
if(!lastWasSpace && logicalLength <= maxLineLen)
{
lastInLine = i;
lastWordOffset = i;
lastWasSpace = true;
}
logicalLength++;
if(!lastWasSpace &&
logicalLength <= maxLineLen + 1)
{
lastInLine = i;
lastWordOffset = i;
lastWasSpace = true;
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/JEditTextArea.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/textarea/JEditTextArea.java
|
Method name: boolean doWordWrap(boolean)
|
|
Method name: boolean doWordWrap(boolean)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | logicalLength += tabSize - (logicalLength % tabSize);↵ | | 1 | logicalLength++;↵
|
2 | if(!lastWasSpace && ↵ | | 2 | if(!lastWasSpace &&↵
|
3 | logicalLength <= maxLineLen)↵ | | 3 | logicalLength <= maxLineLen + 1)↵
|
4 | {↵ | | 4 | {↵
|
5 | lastInLine = i;↵ | | 5 | lastInLine = i;↵
|
6 | lastWordOffset = i;↵ | | 6 | lastWordOffset = i;↵
|
7 | lastWasSpace = true;↵ | | 7 | lastWasSpace = true;↵
|
8 | } | | 8 | }
|
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.3 |
Clones location | Clones are in the same method |
Number of node comparisons | 19 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
21 | logicalLength += tabSize - (logicalLength % tabSize); | | | |
| | | 27 | logicalLength++; |
22 | if (!lastWasSpace && logicalLength <= maxLineLen) | | 28 | if (!lastWasSpace && logicalLength <= maxLineLen + 1) |
23 | | | 29 | |
24 | | | 30 | |
25 | | | 31 | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement logicalLength+=tabSize - (logicalLength % tabSize); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement logicalLength++; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variables lastWasSpace, lastInLine, lastWordOffset , while Clone fragment #2 returns variables lastWasSpace, lastInLine, lastWordOffset |