EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false); if (eAnnotation != null) { Object kind = eAnnotation.getDetails().get("kind"); if (kind != null) { for (int i = 1; i < FEATURE_KINDS.length; ++i) { if (FEATURE_KINDS[i].equals(kind)) { return i; } } } } return 0;
EAnnotation eAnnotation = getAnnotation(eClass, false); if (eAnnotation != null) { Object kind = eAnnotation.getDetails().get("kind"); if (kind != null) { for (int i = 1; i < CONTENT_KINDS.length; ++i) { if (CONTENT_KINDS[i].equals(kind)) { return i; } } } } return 0;
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: int basicGetFeatureKind(EStructuralFeature) Method name: int basicGetContentKind(EClass)
Number of AST nodes: 8 Number of AST nodes: 8
1
EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
1
EAnnotation eAnnotation = getAnnotation(eClass, false);
2
    if (eAnnotation != null)
2
    if (eAnnotation != null)
3
    {
3
    {
4
      Object kind = eAnnotation.getDetails().get("kind");
4
      Object kind = eAnnotation.getDetails().get("kind");
5
      if (kind != null)
5
      if (kind != null)
6
      {
6
      {
7
        for (int i = 1; i < FEATURE_KINDS.length; ++i)
7
        for (int i = 1; i < CONTENT_KINDS.length; ++i)
8
        {
8
        {
9
          if (FEATURE_KINDS[i].equals(kind))
9
          if (CONTENT_KINDS[i].equals(kind))
10
          {
10
          {
11
            return i;
11
            return i;
12
          }
12
          }
13
        }
13
        }
14
      }
14
      }
15
    }
15
    }
16
    return 0;
16
    return 0;
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.4
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Non-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.1
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
    1
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
    1
    EAnnotation eAnnotation = getAnnotation(eClass, false);
    Differences
    Expression1Expression2Difference
    eStructuralFeatureeClassVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EStructuralFeatureorg.eclipse.emf.ecore.EClassVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature does not match with type org.eclipse.emf.ecore.EClass of variable eClass
    • Make classes org.eclipse.emf.ecore.EStructuralFeature and org.eclipse.emf.ecore.EClass extend a common superclass
    1
    EAnnotation eAnnotation = getAnnotation(eClass, false);
    2
    if (eAnnotation != null)
    2
    if (eAnnotation != null)
    3
    Object kind = eAnnotation.getDetails().get("kind");
    3
    Object kind = eAnnotation.getDetails().get("kind");
    4
    if (kind != null)
    4
    if (kind != null)
    5
    for (int i = 1; i < FEATURE_KINDS.length; ++i)
    5
    for (int i = 1; i < FEATURE_KINDS.length; ++i)
    5
    for (int i = 1; i < CONTENT_KINDS.length; ++i)
    Differences
    Expression1Expression2Difference
    FEATURE_KINDSCONTENT_KINDSVARIABLE_NAME_MISMATCH
    5
    for (int i = 1; i < CONTENT_KINDS.length; ++i)
    6
    if (FEATURE_KINDS[i].equals(kind))
    6
    if (FEATURE_KINDS[i].equals(kind))
    6
    if (CONTENT_KINDS[i].equals(kind))
    Differences
    Expression1Expression2Difference
    FEATURE_KINDSCONTENT_KINDSVARIABLE_NAME_MISMATCH
    6
    if (CONTENT_KINDS[i].equals(kind))
    7
    return i;
    7
    return i;
    8
    return 0;
    8
    return 0;
    Precondition Violations (1)
    Row Violation
    1Type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature does not match with type org.eclipse.emf.ecore.EClass of variable eClass