while (i >= 0)
{
UndoableEdit edit = edits.elementAt(i--);
if (edit.isSignificant())
{
if (edit instanceof AbstractDocument.DefaultDocumentEvent)
{
if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())
{
return edit;
}
}
else
{
return edit;
}
}
}
while (i < count)
{
UndoableEdit edit = edits.elementAt(i++);
if (edit.isSignificant())
{
if (edit instanceof AbstractDocument.DefaultDocumentEvent)
{
if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())
{
return edit;
}
}
else
{
return edit;
}
}
}
Clone fragments detected by clone detection tool
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SquirrelDefaultUndoManager.java
|
|
File path: /sql12/app/src/net/sourceforge/squirrel_sql/client/session/mainpanel/SquirrelDefaultUndoManager.java
|
Method name: UndoableEdit editToBeUndone()
|
|
Method name: UndoableEdit editToBeRedone()
|
Number of AST nodes: 7
|
|
Number of AST nodes: 7
|
|
1 | while (i >= 0)↵ | | 1 | while (i < count)↵
|
2 | {↵ | | 2 | {↵
|
3 | UndoableEdit edit = edits.elementAt(i--);↵ | | 3 | UndoableEdit edit = edits.elementAt(i++);↵
|
4 | if (edit.isSignificant())↵ | | 4 | if (edit.isSignificant())↵
|
5 | {↵ | | 5 | {↵
|
6 | if (edit instanceof AbstractDocument.DefaultDocumentEvent)↵ | | 6 | if (edit instanceof AbstractDocument.DefaultDocumentEvent)↵
|
7 | {↵ | | 7 | {↵
|
8 | if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())↵ | | 8 | if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType())↵
|
9 | {↵ | | 9 | {↵
|
10 | return edit;↵ | | 10 | return edit;↵
|
11 | }↵ | | 11 | }↵
|
12 | }↵ | | 12 | }↵
|
13 | else↵ | | 13 | else↵
|
14 | {↵ | | 14 | {↵
|
15 | return edit;↵ | | 15 | return edit;↵
|
16 | }↵ | | 16 | }↵
|
17 | }↵ | | 17 | }↵
|
18 | } | | 18 | }
|
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) | 1.1 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 13 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 7 |
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) | 2.4 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
5 | while (i >= 0) | | 6 | while (i < count) |
6 | UndoableEdit edit = edits.elementAt(i--); | | 7 | UndoableEdit edit = edits.elementAt(i++); |
7 | if (edit.isSignificant()) | | 8 | if (edit.isSignificant()) |
8 | if (edit instanceof AbstractDocument.DefaultDocumentEvent) | | 9 | if (edit instanceof AbstractDocument.DefaultDocumentEvent) |
9 | if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType()) | | 10 | if (DocumentEvent.EventType.CHANGE != ((AbstractDocument.DefaultDocumentEvent)edit).getType()) |
10 | | | 11 | |
| | | | |
11 | | | 12 | |
Precondition Violations (3)
Row |
Violation |
1 | Expression i >= 0 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression i < count cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Not all possible execution flows end in a return statement |