int position = target.indexOf(copyReferencedEObject); if (position == -1) { target.addUnique(index, copyReferencedEObject); } else if (index != position) { target.move(index, copyReferencedEObject); }
int index = list.basicIndexOf(value); if (index == -1) { list.addUnique(position, value); } else { list.move(position, index); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/EcoreUtil.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLHelperImpl.java
Method name: void copyReference(EReference, EObject, EObject) Method name: void setValue(EObject, EStructuralFeature, Object, int)
Number of AST nodes: 5 Number of AST nodes: 4
1
int position = target.indexOf(copyReferencedEObject);
1
int 
2
                  if (position
2
index = list.basicIndexOf(value);
3
 == -1)
3
          if (index == -1)
4
                  {
4
          {
5
                    target.addUnique(index, copyReferencedEObject);
5
            
6
    
6
list.addUnique(position, value);
7
              }
7
          
8
   
8
}
9
               else if (index != position)
9
          
10
      
10
else
11
            {
11
          {
12
                    target.move(index, copyReferencedEObject);
12
            
13
        
13
list.move(position, index);
14
          }
14
          }
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in different classes
Number of node comparisons2