int position = finder.findnext();
if(position>=0) {
// mark found pattern (select)
//text.grabFocus();
mark(position,position + findTextField.getText().length());
} else
// delete marks (unselect)
{
mark(0, 0);
JOptionPane.showMessageDialog(this, "String was not found!");
}
int position = finder.find();
if(position>=0) {
// mark found pattern
//text.grabFocus();
mark(position,position + findTextField.getText().length());
} else
// delete marks
{
mark(0, 0);
JOptionPane.showMessageDialog(this, "String was not found!");
}
Clone fragments detected by clone detection tool
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/util/FindDialog.java
|
|
File path: /columba-1.4-src/core/src/main/java/org/columba/core/gui/util/FindDialog.java
|
Method name: void actionPerformed(ActionEvent)
|
|
Method name: void actionPerformed(ActionEvent)
|
Number of AST nodes: 5
|
|
Number of AST nodes: 5
|
|
1 | int position = finder.findnext();↵ | | 1 | int position = finder.find();↵
|
2 | ↵ | | |
|
3 | if(position>=0) {↵ | | 2 | if(position>=0) {↵
|
4 | // mark found pattern (select)↵ | | 3 | // mark found pattern↵
|
5 | //text.grabFocus(); ↵ | | 4 | //text.grabFocus();↵
|
6 | mark(position,position + findTextField.getText().length());↵ | | 5 | mark(position,position + findTextField.getText().length());↵
|
7 | } else↵ | | 6 | } else↵
|
8 | // delete marks (unselect)↵ | | 7 | // delete marks↵
|
9 | {↵ | | 8 | {↵
|
10 | mark(0, 0);↵ | | 9 | mark(0, 0);↵
|
11 | JOptionPane.showMessageDialog(this, "String was not found!");↵ | | 10 | JOptionPane.showMessageDialog(this, "String was not found!");↵
|
12 | } | | 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 the same method |
Number of node comparisons | 18 |
-
{Refactorable}
Mapping Summary
Number of mapped statements | 5 |
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.0 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
17 | int position = finder.findnext(); | | 11 | int position = finder.find(); |
18 | if (position >= 0) | | 12 | if (position >= 0) |
19 | mark(position, position + findTextField.getText().length()); | | 13 | mark(position, position + findTextField.getText().length()); |
| | | | |
20 | | | 14 | |
21 | JOptionPane.showMessageDialog(this, "String was not found!"); | | 15 | JOptionPane.showMessageDialog(this, "String was not found!"); |
Precondition Violations (0)
Row |
Violation |