switch (eClass.getClassifierID()) { case TreePackage.TREE_NODE: return createTreeNode(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); }
switch (eClass.getClassifierID()) { case Ecore2EcorePackage.ECORE2_ECORE_MAPPING_ROOT: return createEcore2EcoreMappingRoot(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeFactoryImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/mapping/ecore2ecore/impl/Ecore2EcoreFactoryImpl.java
Method name: EObject create(EClass) Method name: EObject create(EClass)
Number of AST nodes: 5 Number of AST nodes: 5
1
switch (eClass.getClassifierID())
1
switch (eClass.getClassifierID())
2
    {
2
    {
3
      case TreePackage.TREE_NODE: return createTreeNode();
3
      case Ecore2EcorePackage.ECORE2_ECORE_MAPPING_ROOT: return createEcore2EcoreMappingRoot();
4
      default:
4
      default:
5
        throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
5
        throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
6
    }
6
    }
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 having the same super class
Number of node comparisons13
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements4
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)0.6
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    switch (eClass.getClassifierID())
    1
    switch (eClass.getClassifierID())
    2
    case TreePackage.TREE_NODE:
    2
    case TreePackage.TREE_NODE:
    2
    case Ecore2EcorePackage.ECORE2_ECORE_MAPPING_ROOT:
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.edit.tree.TreePackageorg.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackageVARIABLE_TYPE_MISMATCH
    TREE_NODEECORE2_ECORE_MAPPING_ROOTVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackage of variable Ecore2EcorePackage
    • Make classes org.eclipse.emf.edit.tree.TreePackage and org.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackage extend a common superclass
    2
    case Ecore2EcorePackage.ECORE2_ECORE_MAPPING_ROOT:
                                                                                      
    3
    return createEcore2EcoreMappingRoot();
    Preondition Violations
    Unmatched return createEcore2EcoreMappingRoot();
    3
    return createEcore2EcoreMappingRoot();
    3
    return createTreeNode();
    3
    return createTreeNode();
    Preondition Violations
    Unmatched return createTreeNode();
                                                          
    4
    default:
    4
    default:
    5
    throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
    5
    throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier");
    Precondition Violations (3)
    Row Violation
    1Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.mapping.ecore2ecore.Ecore2EcorePackage of variable Ecore2EcorePackage
    2Unmatched return createEcore2EcoreMappingRoot();
    3Unmatched return createTreeNode();