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 XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot(); 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/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.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 XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot();
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 XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT:
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.edit.tree.TreePackageorg.eclipse.emf.ecore.xml.namespace.XMLNamespacePackageVARIABLE_TYPE_MISMATCH
    TREE_NODEXML_NAMESPACE_DOCUMENT_ROOTVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage does not match with type org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage of variable XMLNamespacePackage
    • Make classes org.eclipse.emf.edit.tree.TreePackage and org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage extend a common superclass
    2
    case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT:
                                                                                          
    3
    return createXMLNamespaceDocumentRoot();
    Preondition Violations
    Unmatched return createXMLNamespaceDocumentRoot();
    3
    return createXMLNamespaceDocumentRoot();
    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.ecore.xml.namespace.XMLNamespacePackage of variable XMLNamespacePackage
    2Unmatched return createXMLNamespaceDocumentRoot();
    3Unmatched return createTreeNode();