switch (featureKind) { case 1: { @SuppressWarnings("unchecked") List<EObject> beforeValue = (List<EObject>)objectToChange.eGet(feature); objectsBeforeApply.addAll(beforeValue); break; } case 2: { Object value = objectToChange.eGet(feature); if (value != null) { objectsBeforeApply.add((EObject)objectToChange.eGet(feature)); } break; } case 3: { @SuppressWarnings("unchecked") List<FeatureMap.Entry> beforeValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature); objectsBeforeApply.addAll(getContainedEObjects(beforeValue)); break; } }
switch (featureKind) { case 1: { @SuppressWarnings("unchecked") List<EObject> afterValue = (List<EObject>)objectToChange.eGet(feature); objectsAfterApply.addAll(afterValue); break; } case 2: { Object value = objectToChange.eGet(feature); if (value != null) { objectsAfterApply.add((EObject)objectToChange.eGet(feature)); } break; } case 3: { @SuppressWarnings("unchecked") List<FeatureMap.Entry> afterValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature); objectsAfterApply.addAll(getContainedEObjects(afterValue)); break; } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/change/impl/ChangeDescriptionImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/change/impl/ChangeDescriptionImpl.java
Method name: void applyAndReverse() Method name: void applyAndReverse()
Number of AST nodes: 14 Number of AST nodes: 14
1
switch (featureKind)
1
switch (featureKind)
2
        {
2
        {
3
          case 1:
3
          case 1:
4
          {
4
          {
5
            @SuppressWarnings("unchecked") List<EObject> beforeValue = (List<EObject>)objectToChange.eGet(feature);
5
            @SuppressWarnings("unchecked") List<EObject> afterValue = (List<EObject>)objectToChange.eGet(feature);
6
            objectsBeforeApply.addAll(beforeValue);
6
            objectsAfterApply.addAll(afterValue);
7
            break;
7
            break;
8
          }
8
          }
9
          case 2:
9
          case 2:
10
          {
10
          {
11
            Object value = objectToChange.eGet(feature);
11
            Object value = objectToChange.eGet(feature);
12
            if (value != null)
12
            if (value != null)
13
            {
13
            {
14
              objectsBeforeApply.add((EObject)objectToChange.eGet(feature));
14
              objectsAfterApply.add((EObject)objectToChange.eGet(feature));
15
            }
15
            }
16
            break;
16
            break;
17
          }            
17
          }            
18
          case 3:
18
          case 3:
19
          {
19
          {
20
            @SuppressWarnings("unchecked") List<FeatureMap.Entry> beforeValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
20
            @SuppressWarnings("unchecked") List<FeatureMap.Entry> afterValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
21
            objectsBeforeApply.addAll(getContainedEObjects(beforeValue));
21
            objectsAfterApply.addAll(getContainedEObjects(afterValue));
22
            break;
22
            break;
23
          }
23
          }
24
        }
24
        }
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.2
Clones locationClones are in the same method
Number of node comparisons90
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements14
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)7.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    9
    switch (featureKind)
    24
    switch (featureKind)
    10
    case 1:
    25
    case 1:
    11
    @SuppressWarnings("unchecked") List<EObject> beforeValue = (List<EObject>)objectToChange.eGet(feature);
    11
    @SuppressWarnings("unchecked") List<EObject> beforeValue = (List<EObject>)objectToChange.eGet(feature);
    26
    @SuppressWarnings("unchecked") List<EObject> afterValue = (List<EObject>)objectToChange.eGet(feature);
    Differences
    Expression1Expression2Difference
    beforeValueafterValueVARIABLE_NAME_MISMATCH
    26
    @SuppressWarnings("unchecked") List<EObject> afterValue = (List<EObject>)objectToChange.eGet(feature);
    12
    objectsBeforeApply.addAll(beforeValue);
    12
    objectsBeforeApply.addAll(beforeValue);
    27
    objectsAfterApply.addAll(afterValue);
    Differences
    Expression1Expression2Difference
    beforeValueafterValueVARIABLE_NAME_MISMATCH
    objectsBeforeApplyobjectsAfterApplyVARIABLE_NAME_MISMATCH
    27
    objectsAfterApply.addAll(afterValue);
    13
    break;
    28
    break;
    14
    case 2:
    29
    case 2:
    15
    Object value = objectToChange.eGet(feature);
    30
    Object value = objectToChange.eGet(feature);
    16
    if (value != null)
    31
    if (value != null)
    17
    objectsBeforeApply.add((EObject)objectToChange.eGet(feature));
    17
    objectsBeforeApply.add((EObject)objectToChange.eGet(feature));
    32
    objectsAfterApply.add((EObject)objectToChange.eGet(feature));
    Differences
    Expression1Expression2Difference
    objectsBeforeApplyobjectsAfterApplyVARIABLE_NAME_MISMATCH
    32
    objectsAfterApply.add((EObject)objectToChange.eGet(feature));
    18
    break;
    33
    break;
    19
    case 3:
    34
    case 3:
    20
    @SuppressWarnings("unchecked") List<FeatureMap.Entry> beforeValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
    20
    @SuppressWarnings("unchecked") List<FeatureMap.Entry> beforeValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
    35
    @SuppressWarnings("unchecked") List<FeatureMap.Entry> afterValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
    Differences
    Expression1Expression2Difference
    beforeValueafterValueVARIABLE_NAME_MISMATCH
    35
    @SuppressWarnings("unchecked") List<FeatureMap.Entry> afterValue = (List<FeatureMap.Entry>)objectToChange.eGet(feature);
    21
    objectsBeforeApply.addAll(getContainedEObjects(beforeValue));
    21
    objectsBeforeApply.addAll(getContainedEObjects(beforeValue));
    36
    objectsAfterApply.addAll(getContainedEObjects(afterValue));
    Differences
    Expression1Expression2Difference
    beforeValueafterValueVARIABLE_NAME_MISMATCH
    objectsBeforeApplyobjectsAfterApplyVARIABLE_NAME_MISMATCH
    36
    objectsAfterApply.addAll(getContainedEObjects(afterValue));
    22
    break;
    37
    break;
    Precondition Violations (0)
    Row Violation