if (elementHandler == null) { return null; } else { featureClassifierPair.eStructuralFeature = eStructuralFeature; featureClassifierPair.eClassifier = eClassifier; EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair); if (result == NULL_FEATURE) { result = null; } else { result = elementHandler.getSubstitutionGroup(extendedMetaData, eStructuralFeature, eClassifier); substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result); featureClassifierPair = new FeatureClassifierPair(); } return result; }
if (elementHandler == null) { return null; } else { featureClassifierPair.eStructuralFeature = NULL_FEATURE; featureClassifierPair.eClassifier = eClassifier; EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair); if (result == NULL_FEATURE) { result = null; } else { result = elementHandler.getRoot(extendedMetaData, eClassifier); substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result); featureClassifierPair = new FeatureClassifierPair(); } return result; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/xmi/impl/XMLSaveImpl.java
Method name: EStructuralFeature getSubstitutionGroup(EStructuralFeature, EClassifier) Method name: EStructuralFeature getRoot(EClassifier)
Number of AST nodes: 11 Number of AST nodes: 11
1
if (elementHandler == null)
1
if (elementHandler == null)
2
      {
2
      {
3
        return null;
3
        return null;
4
      }
4
      }
5
      else
5
      else
6
      {
6
      {
7
        featureClassifierPair.eStructuralFeature = eStructuralFeature;
7
        featureClassifierPair.eStructuralFeature = NULL_FEATURE;
8
        featureClassifierPair.eClassifier = eClassifier;
8
        featureClassifierPair.eClassifier = eClassifier;
9
        EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair);
9
        EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair);
10
        if (result == NULL_FEATURE)
10
        if (result == NULL_FEATURE)
11
        {
11
        {
12
          result = null;
12
          result = null;
13
        }
13
        }
14
        else
14
        else
15
        {
15
        {
16
          result = elementHandler.getSubstitutionGroup(extendedMetaData, eStructuralFeature, eClassifier);
16
          result = elementHandler.getRoot(extendedMetaData, eClassifier);
17
          substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result);
17
          substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result);
18
          featureClassifierPair = new FeatureClassifierPair();
18
          featureClassifierPair = new FeatureClassifierPair();
19
        }
19
        }
20
        return result;
20
        return result;
21
      }
21
      }
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 comparisons61
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)3.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (elementHandler == null)
    1
    if (elementHandler == null)
    2
    return null;
    2
    return null;
    else
    else
    3
    featureClassifierPair.eStructuralFeature = eStructuralFeature;
    3
    featureClassifierPair.eStructuralFeature = eStructuralFeature;
    3
    featureClassifierPair.eStructuralFeature = NULL_FEATURE;
    Differences
    Expression1Expression2Difference
    eStructuralFeatureNULL_FEATUREVARIABLE_NAME_MISMATCH
    3
    featureClassifierPair.eStructuralFeature = NULL_FEATURE;
    4
    featureClassifierPair.eClassifier = eClassifier;
    4
    featureClassifierPair.eClassifier = eClassifier;
    5
    EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair);
    5
    EStructuralFeature result = substitutionGroupMap.get(featureClassifierPair);
    6
    if (result == NULL_FEATURE)
    6
    if (result == NULL_FEATURE)
    7
    result = null;
    7
    result = null;
    else
    else
    8
    result = elementHandler.getSubstitutionGroup(extendedMetaData, eStructuralFeature, eClassifier);
    8
    result = elementHandler.getSubstitutionGroup(extendedMetaData, eStructuralFeature, eClassifier);
    8
    result = elementHandler.getRoot(extendedMetaData, eClassifier);
    Differences
    Expression1Expression2Difference
    getSubstitutionGroupgetRootMETHOD_INVOCATION_NAME_MISMATCH
    elementHandler.getSubstitutionGroup(extendedMetaData,eStructuralFeature,eClassifier)elementHandler.getRoot(extendedMetaData,eClassifier)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression elementHandler.getSubstitutionGroup(extendedMetaData,eStructuralFeature,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression elementHandler.getRoot(extendedMetaData,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression elementHandler.getSubstitutionGroup(extendedMetaData,eStructuralFeature,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression elementHandler.getRoot(extendedMetaData,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    result = elementHandler.getRoot(extendedMetaData, eClassifier);
    9
    substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result);
    9
    substitutionGroupMap.put(featureClassifierPair, result == null ? NULL_FEATURE : result);
    10
    featureClassifierPair = new FeatureClassifierPair();
    10
    featureClassifierPair = new FeatureClassifierPair();
    11
    return result;
    11
    return result;
    Precondition Violations (4)
    Row Violation
    1Expression elementHandler.getSubstitutionGroup(extendedMetaData,eStructuralFeature,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression elementHandler.getRoot(extendedMetaData,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression elementHandler.getSubstitutionGroup(extendedMetaData,eStructuralFeature,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression elementHandler.getRoot(extendedMetaData,eClassifier) cannot be parameterized, because it has dependencies to/from statements that will be extracted