if (result == null) { result = allAttributes; } else { if (!changeable) { changeable = true; result = new UniqueEList<EStructuralFeature>(result); } result.addAll(allAttributes); }
if (result == null) { return attributes; } else { if (!changeable) { result = new UniqueEList<EStructuralFeature>(result); } result.addAll(attributes); return result; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicExtendedMetaData.java
Method name: List getAllAttributes(EClass) Method name: List getAllAttributes(EClass)
Number of AST nodes: 6 Number of AST nodes: 6
1
if (result == null)
1
if (result == null)
2
        {
2
      
3
  
3
{
4
        result = allAttributes;
4
        return attributes;
5
        }
5
      }
6
        else
6
      else
7
        {
7
      {
8
          if (!changeable)
8
        if (!changeable)
9
          {
9
        {
10
            changeable = true;
11
            result = new UniqueEList<EStructuralFeature>(result);
10
          result = new UniqueEList<EStructuralFeature>(result);
12
          }
11
        
13
  
12
}
14
        result.addAll(allAttributes);
13
        result.addAll(attributes);
15
  
14
        return result;
16
      }
15
      }
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 the same method
Number of node comparisons20
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    8
    if (result == null)
    16
    if (result == null)
    9
    result = allAttributes;
    9
    result = allAttributes;
    Preondition Violations
    Unmatched statement result=allAttributes; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                    
                                                
    17
    return attributes;
    Preondition Violations
    Unmatched return attributes;
    17
    return attributes;
    else
    else
    10
    if (!changeable)
    18
    if (!changeable)
    11
    changeable = true;
    11
    changeable = true;
    Preondition Violations
    Unmatched statement changeable=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                            
    12
    result = new UniqueEList<EStructuralFeature>(result);
    19
    result = new UniqueEList<EStructuralFeature>(result);
    13
    result.addAll(allAttributes);
    13
    result.addAll(allAttributes);
    20
    result.addAll(attributes);
    Differences
    Expression1Expression2Difference
    allAttributesattributesVARIABLE_NAME_MISMATCH
    20
    result.addAll(attributes);
                                        
    21
    return result;
    Preondition Violations
    Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    Unmatched return result;
    21
    return result;
    Precondition Violations (5)
    Row Violation
    1Unmatched statement result=allAttributes; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    2Unmatched return attributes;
    3Unmatched statement changeable=true; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched statement return result; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    5Unmatched return result;