if(getSelectionEnd() != getDocument().getLength())
{
setCaretPosition(getDocument().getLength());
}
String text = getText().substring(0,getSelectionStart());
if(text == null)
{
historyPrevious();
return;
}
if(getSelectionEnd() != getDocument().getLength())
{
setCaretPosition(getDocument().getLength());
}
String text = getText().substring(0,getSelectionStart());
if(text == null)
{
historyNext();
return;
}
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/HistoryTextField.java
|
|
File path: /jEdit-4.2/src/org/gjt/sp/jedit/gui/HistoryTextField.java
|
Method name: void doBackwardSearch()
|
|
Method name: void doForwardSearch()
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if(getSelectionEnd() != getDocument().getLength())↵ | | 1 | if(getSelectionEnd() != getDocument().getLength())↵
|
2 | {↵ | | 2 | {↵
|
3 | setCaretPosition(getDocument().getLength());↵ | | 3 | setCaretPosition(getDocument().getLength());↵
|
4 | }↵ | | 4 | }↵
|
|
5 | String text = getText().substring(0,getSelectionStart());↵ | | 5 | String text = getText().substring(0,getSelectionStart());↵
|
6 | if(text == null)↵ | | 6 | if(text == null)↵
|
7 | {↵ | | 7 | {↵
|
8 | historyPrevious();↵ | | 8 | historyNext();↵
|
9 | return;↵ | | 9 | return;↵
|
10 | } | | 10 | }
|
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.4 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 22 |
-
{Non-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.5 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
3 | if (getSelectionEnd() != getDocument().getLength()) | | 3 | if (getSelectionEnd() != getDocument().getLength()) |
4 | setCaretPosition(getDocument().getLength()); | | 4 | setCaretPosition(getDocument().getLength()); |
5 | String text = getText().substring(0, getSelectionStart()); | | 5 | String text = getText().substring(0, getSelectionStart()); |
6 | if (text == null) | | 6 | if (text == null) |
7 | | | 7 | |
8 | | | 8 | |
Precondition Violations (4)
Row |
Violation |
1 | Expression historyPrevious() is a void method call, and thus it cannot be parameterized |
2 | Expression historyNext() is a void method call, and thus it cannot be parameterized |
3 | Conditional return; |
4 | Conditional return; |