EditPane[] editPanes = getEditPanes(); for(int i = 0; i < editPanes.length; i++) { if(editPane == editPanes[i]) { if(i == editPanes.length - 1) editPanes[0].focusOnTextArea(); else editPanes[i+1].focusOnTextArea(); break; } }
EditPane[] editPanes = getEditPanes(); for(int i = 0; i < editPanes.length; i++) { if(editPane == editPanes[i]) { if(i == 0) editPanes[editPanes.length - 1].focusOnTextArea(); else editPanes[i-1].focusOnTextArea(); break; } }
Clone fragments detected by clone detection tool
File path: /jEdit-4.2/src/org/gjt/sp/jedit/View.java File path: /jEdit-4.2/src/org/gjt/sp/jedit/View.java
Method name: void nextTextArea() Method name: void prevTextArea()
Number of AST nodes: 7 Number of AST nodes: 7
1
EditPane[] editPanes = getEditPanes();
1
EditPane[] editPanes = getEditPanes();
2
		for(int i = 0; i < editPanes.length; i++)
2
		for(int i = 0; i < editPanes.length; i++)
3
		{
3
		{
4
			if(editPane == editPanes[i])
4
			if(editPane == editPanes[i])
5
			{
5
			{
6
				if(i == 
6
				if(i == 0)
7
editPanes.length - 1)
7
					editPanes[editPanes.length - 1
8
					editPanes[0].focusOnTextArea();
8
].focusOnTextArea();
9
				else
9
				else
10
					editPanes[i+1].focusOnTextArea();
10
					editPanes[i-1].focusOnTextArea();
11
				break;
11
				break;
12
			}
12
			}
13
		}
13
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.5
Clones locationClones are declared in the same class
Number of node comparisons15
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    EditPane[] editPanes = getEditPanes();
    1
    EditPane[] editPanes = getEditPanes();
    2
    for (int i = 0; i < editPanes.length; i++)
    2
    for (int i = 0; i < editPanes.length; i++)
    3
    if (editPane == editPanes[i])
    3
    if (editPane == editPanes[i])
    4
    if (i == editPanes.length - 1)
    4
    if (i == editPanes.length - 1)
    4
    if (i == 0)
    Differences
    Expression1Expression2Difference
    editPanes.length - 10INFIX_RIGHT_OPERAND_MISMATCH
    Preondition Violations
    Expression editPanes.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (i == 0)
    5
    editPanes[0].focusOnTextArea();
    5
    editPanes[0].focusOnTextArea();
    5
    editPanes[editPanes.length - 1].focusOnTextArea();
    Differences
    Expression1Expression2Difference
    0editPanes.length - 1TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression editPanes.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5
    editPanes[editPanes.length - 1].focusOnTextArea();
    else
            
                                                                                
    6
    editPanes[i - 1].focusOnTextArea();
    Preondition Violations
    Unmatched statement editPanes[i - 1].focusOnTextArea(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    6
    editPanes[i - 1].focusOnTextArea();
    6
    editPanes[i + 1].focusOnTextArea();
    6
    editPanes[i + 1].focusOnTextArea();
    Preondition Violations
    Unmatched statement editPanes[i + 1].focusOnTextArea(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                
    7
    break;
    7
    break;
    Precondition Violations (5)
    Row Violation
    1Expression editPanes.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression editPanes.length - 1 cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched statement editPanes[i - 1].focusOnTextArea(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement editPanes[i + 1].focusOnTextArea(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    5Clone fragment #1 returns variables editPanes, i , while Clone fragment #2 returns variables editPanes, i