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
				}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in the same method
Number of node comparisons18
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    17
    int position = finder.findnext();
    17
    int position = finder.findnext();
    11
    int position = finder.find();
    Differences
    Expression1Expression2Difference
    findnextfindMETHOD_INVOCATION_NAME_MISMATCH
    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());
    else
    else
    20
    mark(0, 0);
    14
    mark(0, 0);
    21
    JOptionPane.showMessageDialog(this, "String was not found!");
    15
    JOptionPane.showMessageDialog(this, "String was not found!");
    Precondition Violations (0)
    Row Violation