switch (eClass.getClassifierID()) { case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot(); default: throw new IllegalArgumentException("The class '" + eClass.getName() + "' is not a valid classifier"); }
switch (eClass.getClassifierID()) { case TreePackage.TREE_NODE: return createTreeNode(); 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/ecore/xml/namespace/impl/XMLNamespaceFactoryImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/edit/tree/impl/TreeFactoryImpl.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 XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT: return createXMLNamespaceDocumentRoot();
3
      case TreePackage.TREE_NODE: 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");
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.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    switch (eClass.getClassifierID())
    1
    switch (eClass.getClassifierID())
    2
    case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT:
    2
    case XMLNamespacePackage.XML_NAMESPACE_DOCUMENT_ROOT:
    2
    case TreePackage.TREE_NODE:
    Differences
    Expression1Expression2Difference
    org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackageorg.eclipse.emf.edit.tree.TreePackageVARIABLE_TYPE_MISMATCH
    XML_NAMESPACE_DOCUMENT_ROOTTREE_NODEVARIABLE_NAME_MISMATCH
    Preondition Violations
    Type org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage of variable XMLNamespacePackage does not match with type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage
    • Make classes org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage and org.eclipse.emf.edit.tree.TreePackage extend a common superclass
    2
    case TreePackage.TREE_NODE:
                                                          
    3
    return createTreeNode();
    Preondition Violations
    Unmatched return createTreeNode();
    3
    return createTreeNode();
    3
    return createXMLNamespaceDocumentRoot();
    3
    return createXMLNamespaceDocumentRoot();
    Preondition Violations
    Unmatched 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");
    Precondition Violations (3)
    Row Violation
    1Type org.eclipse.emf.ecore.xml.namespace.XMLNamespacePackage of variable XMLNamespacePackage does not match with type org.eclipse.emf.edit.tree.TreePackage of variable TreePackage
    2Unmatched return createTreeNode();
    3Unmatched return createXMLNamespaceDocumentRoot();