if (kind > 0 && kind < CONTENT_KINDS.length) { EAnnotation eAnnotation = getAnnotation(eClass, true); eAnnotation.getDetails().put("kind", CONTENT_KINDS[kind]); } else { EAnnotation eAnnotation = getAnnotation(eClass, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("kind"); } } getExtendedMetaData(eClass).setContentKind(kind);
if (kind > 0 && kind < FEATURE_KINDS.length) { EAnnotation eAnnotation = getAnnotation(eStructuralFeature, true); eAnnotation.getDetails().put("kind", FEATURE_KINDS[kind]); } else { EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false); if (eAnnotation != null) { eAnnotation.getDetails().remove("kind"); } } getExtendedMetaData(eStructuralFeature).setFeatureKind(kind);
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: void setContentKind(EClass, int) Method name: void setFeatureKind(EStructuralFeature, int)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (kind > 0 && kind < CONTENT_KINDS.length)
1
if (kind > 0 && kind < FEATURE_KINDS.length)
2
    {
2
    {
3
      EAnnotation eAnnotation = getAnnotation(eClass, true);
3
      EAnnotation eAnnotation = getAnnotation(eStructuralFeature, true);
4
      eAnnotation.getDetails().put("kind", CONTENT_KINDS[kind]);
4
      eAnnotation.getDetails().put("kind", FEATURE_KINDS[kind]);
5
    }
5
    }
6
    else
6
    else
7
    {
7
    {
8
      EAnnotation eAnnotation = getAnnotation(eClass, false);
8
      EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
9
      if (eAnnotation != null)
9
      if (eAnnotation != null)
10
      {
10
      {
11
        eAnnotation.getDetails().remove("kind");
11
        eAnnotation.getDetails().remove("kind");
12
      }
12
      }
13
    }
13
    }
14
    getExtendedMetaData(eClass).setContentKind(kind);
14
    getExtendedMetaData(eStructuralFeature).setFeatureKind(kind);
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 declared in the same class
Number of node comparisons21
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (kind > 0 && kind < CONTENT_KINDS.length)
    1
    if (kind > 0 && kind < CONTENT_KINDS.length)
    1
    if (kind > 0 && kind < FEATURE_KINDS.length)
    Differences
    Expression1Expression2Difference
    CONTENT_KINDSFEATURE_KINDSVARIABLE_NAME_MISMATCH
    1
    if (kind > 0 && kind < FEATURE_KINDS.length)
    2
    EAnnotation eAnnotation = getAnnotation(eClass, true);
    2
    EAnnotation eAnnotation = getAnnotation(eClass, true);
    2
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, true);
    Differences
    Expression1Expression2Difference
    eClasseStructuralFeatureVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EClassorg.eclipse.emf.ecore.EStructuralFeatureVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EClass of variable eClass does not match with type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature
    • Make classes org.eclipse.emf.ecore.EClass and org.eclipse.emf.ecore.EStructuralFeature extend a common superclass
    2
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, true);
    3
    eAnnotation.getDetails().put("kind", CONTENT_KINDS[kind]);
    3
    eAnnotation.getDetails().put("kind", CONTENT_KINDS[kind]);
    3
    eAnnotation.getDetails().put("kind", FEATURE_KINDS[kind]);
    Differences
    Expression1Expression2Difference
    CONTENT_KINDSFEATURE_KINDSVARIABLE_NAME_MISMATCH
    3
    eAnnotation.getDetails().put("kind", FEATURE_KINDS[kind]);
    else
    else
    4
    EAnnotation eAnnotation = getAnnotation(eClass, false);
    4
    EAnnotation eAnnotation = getAnnotation(eClass, false);
    4
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
    Differences
    Expression1Expression2Difference
    eClasseStructuralFeatureVARIABLE_NAME_MISMATCH
    org.eclipse.emf.ecore.EClassorg.eclipse.emf.ecore.EStructuralFeatureVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.EClass of variable eClass does not match with type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature
    • Make classes org.eclipse.emf.ecore.EClass and org.eclipse.emf.ecore.EStructuralFeature extend a common superclass
    4
    EAnnotation eAnnotation = getAnnotation(eStructuralFeature, false);
    5
    if (eAnnotation != null)
    5
    if (eAnnotation != null)
    6
    eAnnotation.getDetails().remove("kind");
    6
    eAnnotation.getDetails().remove("kind");
                                                                                                                                    
    7
    getExtendedMetaData(eStructuralFeature).setFeatureKind(kind);
    7
    getExtendedMetaData(eClass).setContentKind(kind);
                                                                                                            
    Precondition Violations (2)
    Row Violation
    1Type org.eclipse.emf.ecore.EClass of variable eClass does not match with type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature
    2Type org.eclipse.emf.ecore.EClass of variable eClass does not match with type org.eclipse.emf.ecore.EStructuralFeature of variable eStructuralFeature