if (object instanceof FeatureMap.Entry) { return super.basicRemove(object, notifications); } else { Entry match = null; EStructuralFeature feature = null; Entry [] entries = (Entry[])data; for (int i = 0; i < size; ++i) { Entry entry = entries[i]; if (object.equals(entry.getValue())) { feature = entry.getEStructuralFeature(); if (feature instanceof EReference && ((EReference)feature).isContainment()) { match = entry; break; } } } if (match != null) { if (isNotificationRequired()) { @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification (Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification (feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true); if (notifications != null) { notifications.add(notification); } else { notifications = notification; } } notifications = basicRemove(match, notifications); } return notifications; }
if (object instanceof FeatureMap.Entry) { return super.basicRemove(object, notifications); } else { Entry match = null; EStructuralFeature feature = null; for (int i = 0, size = delegateSize(); i < size; ++i) { Entry entry = delegateGet(i); if (object.equals(entry.getValue())) { feature = entry.getEStructuralFeature(); if (feature instanceof EReference && ((EReference)feature).isContainment()) { match = entry; break; } } } if (match != null) { if (isNotificationRequired()) { @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification (Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification (feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true); if (notifications != null) { notifications.add(notification); } else { notifications = notification; } } notifications = basicRemove(match, notifications); } return notifications; }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/BasicFeatureMap.java File path: /emf-2.4.1/src/org/eclipse/emf/ecore/util/DelegatingFeatureMap.java
Method name: NotificationChain basicRemove(Object, NotificationChain) Method name: NotificationChain basicRemove(Object, NotificationChain)
Number of AST nodes: 20 Number of AST nodes: 19
1
if (object instanceof FeatureMap.Entry)
1
if (object instanceof FeatureMap.Entry)
2
    {
2
    {
3
      return super.basicRemove(object, notifications);
3
      return super.basicRemove(object, notifications);
4
    }
4
    }
5
    else
5
    else
6
    {
6
    {
7
      Entry match = null;
7
      Entry match = null;
8
      EStructuralFeature feature = null;
8
      EStructuralFeature feature = null;
9
      Entry [] entries = (Entry[])data;
9
      
10
      for (int i = 0; i < size; ++i)
10
for (int i = 0, size = delegateSize(); i < size; ++i)
11
      {
11
      {
12
        Entry entry = entries[i];
12
        Entry entry = delegateGet(i); 
13
        if (object.equals(entry.getValue()))
13
        if (object.equals(entry.getValue()))
14
        {
14
        {
15
          feature = entry.getEStructuralFeature();
15
          feature = entry.getEStructuralFeature();
16
          if (feature instanceof EReference && ((EReference)feature).isContainment())
16
          if (feature instanceof EReference && ((EReference)feature).isContainment())
17
          {
17
          {
18
            match = entry;
18
            match = entry;
19
            break;
19
            break;
20
          }
20
          }
21
        }
21
        }
22
      }
22
      }
23
      if (match != null)
23
      if (match != null)
24
      {
24
      {
25
        if (isNotificationRequired())
25
        if (isNotificationRequired())
26
        {
26
        {
27
          @SuppressWarnings("null")
27
          @SuppressWarnings("null")
28
          NotificationImpl notification =
28
          NotificationImpl notification =
29
            feature.isMany() ?
29
            feature.isMany() ?
30
              createNotification
30
              createNotification
31
                (Notification.REMOVE,
31
                (Notification.REMOVE,
32
                 feature,
32
                 feature,
33
                 object,
33
                 object,
34
                 null,
34
                 null,
35
                 indexOf(feature, object),
35
                 indexOf(feature, object),
36
                 true) :
36
                 true) :
37
              createNotification
37
              createNotification
38
                (feature.isUnsettable() ? Notification.UNSET : Notification.SET,
38
                (feature.isUnsettable() ? Notification.UNSET : Notification.SET,
39
                 feature,
39
                 feature,
40
                 object,
40
                 object,
41
                 feature.getDefaultValue(),
41
                 feature.getDefaultValue(),
42
                 Notification.NO_INDEX,
42
                 Notification.NO_INDEX,
43
                 true);
43
                 true);
44
          if (notifications != null)
44
          if (notifications != null)
45
          {
45
          {
46
            notifications.add(notification);
46
            notifications.add(notification);
47
          }
47
          }
48
          else
48
          else
49
          {
49
          {
50
            notifications = notification;
50
            notifications = notification;
51
          }
51
          }
52
        }
52
        }
53
        notifications = basicRemove(match, notifications);
53
        notifications = basicRemove(match, notifications);
54
      }
54
      }
55
      return notifications;
55
      return notifications;
56
    }
56
    }
Summary
Number of common nesting structure subtrees2
Number of refactorable cases0
Number of non-refactorable cases2
Time elapsed for finding largest common nesting structure subtrees (ms)1.1
Clones locationClones are in different classes having the same super class
Number of node comparisons64
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.2
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    7
    Entry entry = entries[i];
    7
    Entry entry = entries[i];
    6
    Entry entry = delegateGet(i);
    Differences
    Expression1Expression2Difference
    entries[i]delegateGet(i)TYPE_COMPATIBLE_REPLACEMENT
    6
    Entry entry = delegateGet(i);
    8
    if (object.equals(entry.getValue()))
    7
    if (object.equals(entry.getValue()))
    9
    feature = entry.getEStructuralFeature();
    8
    feature = entry.getEStructuralFeature();
    10
    if (feature instanceof EReference && ((EReference)feature).isContainment())
    9
    if (feature instanceof EReference && ((EReference)feature).isContainment())
    11
    match = entry;
    10
    match = entry;
    12
    break;
    12
    break;
    11
    break;
    Preondition Violations
    Statement break; without innermost loop
    Statement break; without innermost loop
    11
    break;
    Precondition Violations (3)
    Row Violation
    1Statement break; without innermost loop
    2Statement break; without innermost loop
    3Clone fragment #1 returns variables match, feature , while Clone fragment #2 returns variables match, feature
  2. {Non-refactorable}
    Mapping Summary
    Number of mapped statements12
    Number of unmapped statements in the first code fragment8
    Number of unmapped statements in the second code fragment7
    Time elapsed for statement mapping (ms)4.2
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (object instanceof FeatureMap.Entry)
    1
    if (object instanceof FeatureMap.Entry)
    2
    return super.basicRemove(object, notifications);
    2
    return super.basicRemove(object, notifications);
    else
    else
    3
    Entry match = null;
    3
    Entry match = null;
    4
    EStructuralFeature feature = null;
    4
    EStructuralFeature feature = null;
                                                                                                          
    5
    for (int i = 0, size = delegateSize(); i < size; ++i)
                                                                
    6
    Entry entry = delegateGet(i);
                                                                                
    7
    if (object.equals(entry.getValue()))
    Preondition Violations
    Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    7
    if (object.equals(entry.getValue()))
                                                                                      
    8
    feature = entry.getEStructuralFeature();
    Preondition Violations
    Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8
    feature = entry.getEStructuralFeature();
                                                                                                                                                              
    9
    if (feature instanceof EReference && ((EReference)feature).isContainment())
                                    
    10
    match = entry;
    Preondition Violations
    Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    10
    match = entry;
                        
    11
    break;
    Preondition Violations
    Unmatched break;
    11
    break;
    5
    Entry[] entries = (Entry[])data;
                                                                      
    6
    for (int i = 0; i < size; ++i)
                                                                
    7
    Entry entry = entries[i];
                                                        
    8
    if (object.equals(entry.getValue()))
    8
    if (object.equals(entry.getValue()))
    Preondition Violations
    Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
                                                                                
    9
    feature = entry.getEStructuralFeature();
    9
    feature = entry.getEStructuralFeature();
    Preondition Violations
    Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                                                                      
    10
    if (feature instanceof EReference && ((EReference)feature).isContainment())
                                                                                                                                                                
    11
    match = entry;
    11
    match = entry;
    Preondition Violations
    Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
                                    
    12
    break;
    12
    break;
    Preondition Violations
    Unmatched break;
                        
    13
    if (match != null)
    12
    if (match != null)
    14
    if (isNotificationRequired())
    13
    if (isNotificationRequired())
    15
    @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification(Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification(feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true);
    14
    @SuppressWarnings("null") NotificationImpl notification = feature.isMany() ? createNotification(Notification.REMOVE, feature, object, null, indexOf(feature, object), true) : createNotification(feature.isUnsettable() ? Notification.UNSET : Notification.SET, feature, object, feature.getDefaultValue(), Notification.NO_INDEX, true);
    16
    if (notifications != null)
    15
    if (notifications != null)
    17
    notifications.add(notification);
    16
    notifications.add(notification);
    else
    else
    18
    notifications = notification;
    17
    notifications = notification;
    19
    notifications = basicRemove(match, notifications);
    18
    notifications = basicRemove(match, notifications);
    20
    return notifications;
    19
    return notifications;
    Precondition Violations (9)
    Row Violation
    1Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    2Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    3Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    4Unmatched break;
    5Unmatched statement if(object.equals(entry.getValue())) cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted
    6Unmatched statement feature=entry.getEStructuralFeature(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    7Unmatched statement match=entry; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted
    8Unmatched break;
    9Clone fragment #1 returns variables feature, match , while Clone fragment #2 returns variables feature, match