if (!attributes.isEmpty()) { if (result == null) { return attributes; } else { if (!changeable) { result = new UniqueEList<EStructuralFeature>(result); } result.addAll(attributes); return result; } } else { return result == null ? Collections.<EStructuralFeature>emptyList() : result; }
if (!elements.isEmpty()) { if (result == null) { return elements; } else { if (!changeable) { result = new UniqueEList<EStructuralFeature>(result); } result.addAll(elements); return result; } } else { return result == null ? Collections.<EStructuralFeature>emptyList() : 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 getAllElements(EClass)
Number of AST nodes: 8 Number of AST nodes: 8
1
if (!attributes.isEmpty())
1
if (!elements.isEmpty())
2
    {
2
    {
3
      if (result == null)
3
      if (result == null)
4
      {
4
      {
5
        return attributes;
5
        return elements;
6
      }
6
      }
7
      else
7
      else
8
      {
8
      {
9
        if (!changeable)
9
        if (!changeable)
10
        {
10
        {
11
          result = new UniqueEList<EStructuralFeature>(result);
11
          result = new UniqueEList<EStructuralFeature>(result);
12
        }
12
        }
13
        result.addAll(attributes);
13
        result.addAll(elements);
14
        return result;
14
        return result;
15
      }
15
      }
16
    }
16
    }
17
    else
17
    else
18
    {
18
    {
19
      return result == null ? Collections.<EStructuralFeature>emptyList() : result;
19
      return result == null ? Collections.<EStructuralFeature>emptyList() : result;
20
    }
20
    }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are declared in the same class
Number of node comparisons25
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements8
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.9
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    15
    if (!attributes.isEmpty())
    15
    if (!attributes.isEmpty())
    15
    if (!elements.isEmpty())
    Differences
    Expression1Expression2Difference
    attributeselementsVARIABLE_NAME_MISMATCH
    15
    if (!elements.isEmpty())
    16
    if (result == null)
    16
    if (result == null)
    17
    return attributes;
    17
    return attributes;
    17
    return elements;
    Differences
    Expression1Expression2Difference
    attributeselementsVARIABLE_NAME_MISMATCH
    17
    return elements;
    else
    else
    18
    if (!changeable)
    18
    if (!changeable)
    19
    result = new UniqueEList<EStructuralFeature>(result);
    19
    result = new UniqueEList<EStructuralFeature>(result);
    20
    result.addAll(attributes);
    20
    result.addAll(attributes);
    20
    result.addAll(elements);
    Differences
    Expression1Expression2Difference
    attributeselementsVARIABLE_NAME_MISMATCH
    20
    result.addAll(elements);
    21
    return result;
    21
    return result;
    else
    else
    22
    return result == null ? Collections.<EStructuralFeature>emptyList() : result;
    22
    return result == null ? Collections.<EStructuralFeature>emptyList() : result;
    Precondition Violations (0)
    Row Violation