if (isContainment()) { if (oldValue != newValue) { if (oldValue != null) { notifications = ((InternalEObject)oldValue).eInverseRemove (owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications); } if (newValue != null) { notifications = ((InternalEObject)newValue).eInverseAdd (owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications); } } }
if (hasInverse()) { if (oldValue != otherEnd && oldValue != null) { InternalEObject internalEObject = (InternalEObject)oldValue; notifications = internalEObject.eInverseRemove (owner, internalEObject.eClass().getFeatureID(inverseFeature), null, notifications); } } else if (isContainment()) { if (oldValue != null) { notifications = ((InternalEObject)oldValue).eInverseRemove (owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications); } }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/impl/EStructuralFeatureImpl.java
Method name: void dynamicSet(InternalEObject, EStructuralFeature.Internal.DynamicValueHolder, int, Object) Method name: NotificationChain dynamicInverseAdd(InternalEObject, EStructuralFeature.Internal.DynamicValueHolder, int, InternalEObject, NotificationChain)
Number of AST nodes: 6 Number of AST nodes: 7
1
if (isContainment())
1
if (hasInverse())
2
      {
2
      {
3
        if (oldValue != newValue)
3
        if (oldValue != 
4
        {
5
          if (oldValue != null)
6
          {
7
  
4
otherEnd && oldValue != null)
5
        {
6
          InternalEObject internalEObject = (InternalEObject)oldValue;
8
          notifications = 
7
          notifications = 
9
              ((InternalEObject)oldValue).eInverseRemove
8
            internalEObject.eInverseRemove
10
                (owner,
9
              (owner,
11
                 InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature),
10
               internalEObject.eClass().getFeatureID(inverseFeature),
12
                 null,
11
               null,
13
                 notifications);
12
               notifications);
14
    
13
        }
15
      }
14
      }
16
  
15
      else if (isContainment())
16
      {
17
        if (newValue != null)
17
        if (oldValue != null)
18
          {
18
        
19
  
19
{
20
          notifications = 
20
          notifications = 
21
              ((InternalEObject)newValue).eInverseAdd
21
            ((InternalEObject)oldValue).eInverse
22
  
22
Remove
23
              (owner,
23
              (owner,
24
                 InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature),
24
               InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature),
25
                 null,
25
               null,
26
                 notifications);
26
               notifications);
27
          }
28
        }
27
        }
29
      }
28
      }
Summary
Number of common nesting structure subtrees2
Number of refactorable cases1
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons14
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)2.8
    Clone typeType 1
    Mapped Statements
    ID Statement ID Statement
    16
    if (oldValue != null)
    9
    if (oldValue != null)
    17
    notifications = ((InternalEObject)oldValue).eInverseRemove(owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications);
    10
    notifications = ((InternalEObject)oldValue).eInverseRemove(owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications);
    Precondition Violations (0)
    Row Violation
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)40.5
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    18
    if (newValue != null)
    18
    if (newValue != null)
    5
    if (oldValue != otherEnd && oldValue != null)
    Differences
    Expression1Expression2Difference
    !=&&OPERATOR_MISMATCH
    newValueoldValue != otherEndINFIX_LEFT_OPERAND_MISMATCH
    nulloldValue != nullINFIX_RIGHT_OPERAND_MISMATCH
    5
    if (oldValue != otherEnd && oldValue != null)
                                                                                                                              
    6
    InternalEObject internalEObject = (InternalEObject)oldValue;
    Preondition Violations
    Unmatched statement InternalEObject internalEObject=(InternalEObject)oldValue; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6
    InternalEObject internalEObject = (InternalEObject)oldValue;
    19
    notifications = ((InternalEObject)newValue).eInverseAdd(owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications);
    19
    notifications = ((InternalEObject)newValue).eInverseAdd(owner, InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature), null, notifications);
    7
    notifications = internalEObject.eInverseRemove(owner, internalEObject.eClass().getFeatureID(inverseFeature), null, notifications);
    Differences
    Expression1Expression2Difference
    InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature)internalEObject.eClass().getFeatureID(inverseFeature)TYPE_COMPATIBLE_REPLACEMENT
    eInverseAddeInverseRemoveMETHOD_INVOCATION_NAME_MISMATCH
    ((InternalEObject)newValue)internalEObjectTYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression internalEObject.eClass().getFeatureID(inverseFeature) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((InternalEObject)newValue).eInverseAdd(owner,InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature),null,notifications) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression internalEObject.eInverseRemove(owner,internalEObject.eClass().getFeatureID(inverseFeature),null,notifications) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression ((InternalEObject)newValue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression internalEObject cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7
    notifications = internalEObject.eInverseRemove(owner, internalEObject.eClass().getFeatureID(inverseFeature), null, notifications);
    Precondition Violations (6)
    Row Violation
    1Unmatched statement InternalEObject internalEObject=(InternalEObject)oldValue; cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Expression internalEObject.eClass().getFeatureID(inverseFeature) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression ((InternalEObject)newValue).eInverseAdd(owner,InternalEObject.EOPPOSITE_FEATURE_BASE - owner.eClass().getFeatureID(feature),null,notifications) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Expression internalEObject.eInverseRemove(owner,internalEObject.eClass().getFeatureID(inverseFeature),null,notifications) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    5Expression ((InternalEObject)newValue) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression internalEObject cannot be parameterized, because it has dependencies to/from statements that will be extracted