int index = indexOf(object); if (index >= 0) { remove(index); return true; } else { return false; }
int featureID = eDerivedStructuralFeatureID(eFeature); if (featureID >= 0) { eUnset(featureID); } else { eOpenUnset(eFeature); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/BasicEList.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/BasicEObjectImpl.java
Method name: boolean remove(Object) Method name: void eUnset(EStructuralFeature)
Number of AST nodes: 5 Number of AST nodes: 4
1
int index = indexOf(object);
1
int featureID = eDerivedStructuralFeatureID(eFeature);
2
    if (index >= 0)
2
    if (featureID >= 0)
3
    {
3
    {
4
      remove(index);
4
      
5
      return true;
5
eUnset(featureID);
6
    }
6
    }
7
    else
7
    else
8
    {
8
    {
9
      return false;
9
      eOpenUnset(eFeature);
10
    }
10
    }
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.1
Clones locationClones are in different classes
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements1
    Number of unmapped statements in the first code fragment4
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
                                                                                                                  
    1
    int featureID = eDerivedStructuralFeatureID(eFeature);
    1
    int index = indexOf(object);
                                                              
    2
    if (index >= 0)
    2
    if (index >= 0)
    2
    if (featureID >= 0)
    Differences
    Expression1Expression2Difference
    indexfeatureIDVARIABLE_NAME_MISMATCH
    2
    if (featureID >= 0)
                                              
    3
    eUnset(featureID);
    3
    remove(index);
                                      
    4
    return true;
    4
    return true;
    Preondition Violations
    Unmatched return true;
                                  
    else
            
                                                    
    4
    eOpenUnset(eFeature);
    5
    return false;
    5
    return false;
    Preondition Violations
    Unmatched return false;
                                    
    Precondition Violations (2)
    Row Violation
    1Unmatched return true;
    2Unmatched return false;