selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } // Set the selection to the widget. // selectionViewer.setSelection(new StructuredSelection(selectionList));
selectionList.add(selectedElement); while (selectedElements.hasNext()) { selectionList.add(selectedElements.next()); } // Set the selection to the widget. // selectionViewer.setSelection(new StructuredSelection(selectionList));
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2xml/presentation/Ecore2XMLEditor.java
Method name: void handleContentOutlineSelection(ISelection) Method name: void handleContentOutlineSelection(ISelection)
Number of AST nodes: 4 Number of AST nodes: 4
1
selectionList.add(selectedElement);
1
selectionList.add(selectedElement);
2
        while (selectedElements.hasNext())
2
          while (selectedElements.hasNext())
3
        {
3
        
4
  {
4
          selectionList.add(selectedElements.next());
5
            selectionList.add(selectedElements.next());
5
        }
6
          }
6
        // Set the selection to the widget.
7
          // Set the selection to the widget.
7
        //
8
          //
8
        selectionViewer.setSelection(new StructuredSelection(selectionList));
9
          selectionViewer.setSelection(new StructuredSelection(selectionList));
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.2
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)21.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    6
    selectionList.add(selectedElement);
    7
    selectionList.add(selectedElement);
    7
    while (selectedElements.hasNext())
    7
    while (selectedElements.hasNext())
    8
    while (selectedElements.hasNext())
    Differences
    Expression1Expression2Difference
    java.util.Iterator<>java.util.Iterator<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.Iterator<> of variable selectedElements does not match with type java.util.Iterator<> of variable selectedElements
    • Make classes java.util.Iterator<> and java.util.Iterator<> extend a common superclass
    8
    while (selectedElements.hasNext())
    8
    selectionList.add(selectedElements.next());
    8
    selectionList.add(selectedElements.next());
    9
    selectionList.add(selectedElements.next());
    Differences
    Expression1Expression2Difference
    VARIABLE_TYPE_MISMATCH
    java.util.Iterator<>java.util.Iterator<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Expression selectedElements.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression selectedElements.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Type of variable selectedElements.next() does not match with type of variable selectedElements.next()
    • Make classes and extend a common superclass
    Type java.util.Iterator<> of variable selectedElements does not match with type java.util.Iterator<> of variable selectedElements
    • Make classes java.util.Iterator<> and java.util.Iterator<> extend a common superclass
    9
    selectionList.add(selectedElements.next());
    9
    selectionViewer.setSelection(new StructuredSelection(selectionList));
    10
    selectionViewer.setSelection(new StructuredSelection(selectionList));
    Precondition Violations (5)
    Row Violation
    1Type java.util.Iterator<> of variable selectedElements does not match with type java.util.Iterator<> of variable selectedElements
    2Expression selectedElements.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression selectedElements.next() cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type of variable selectedElements.next() does not match with type of variable selectedElements.next()
    5Type java.util.Iterator<> of variable selectedElements does not match with type java.util.Iterator<> of variable selectedElements