if (size > 0) { Object [] oldData = delegateToArray(); int oldSize = size; doClear(size, oldData); NotificationChain notifications = createNotificationChain(oldSize); for (int i = 0; i < oldSize; ++i) { @SuppressWarnings("unchecked") E object = (E)oldData[i]; notifications = inverseRemove(object, notifications); } if (notifications != null) notifications.dispatch(); } else { doClear(); }
if (size > 0) { Object [] oldData = data; int oldSize = size; doClear(); NotificationChain notifications = createNotificationChain(oldSize); for (int i = 0; i < oldSize; ++i) { @SuppressWarnings("unchecked") E object = (E)oldData[i]; notifications = inverseRemove(object, notifications); } if (notifications != null) notifications.dispatch(); } else { doClear(); }
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/notify/impl/DelegatingNotifyingListImpl.java File path: /emf-2.4.1/src/org/eclipse/emf/common/notify/impl/NotifyingListImpl.java
Method name: void clear() Method name: void clear()
Number of AST nodes: 11 Number of AST nodes: 11
1
if (size > 0)
1
if (size > 0)
2
      {
2
      {
3
        Object [] oldData = delegateToArray();
3
        Object [] oldData = data;
4
        int oldSize = size;
4
        int oldSize = size;
5
        doClear(size, oldData);
5
        doClear();
6
        NotificationChain notifications = createNotificationChain(oldSize);
6
        NotificationChain notifications = createNotificationChain(oldSize);
7
        for (int i = 0; i < oldSize; ++i)
7
        for (int i = 0; i < oldSize; ++i)
8
        {
8
        {
9
          @SuppressWarnings("unchecked") E object = (E)oldData[i];
9
          @SuppressWarnings("unchecked") E object = (E)oldData[i];
10
          notifications = inverseRemove(object, notifications);
10
          notifications = inverseRemove(object, notifications);
11
        }
11
        }
12
        if (notifications != null) notifications.dispatch();
12
        if (notifications != null) notifications.dispatch();
13
      }
13
      }
14
      else 
14
      else 
15
      {
15
      {
16
        doClear();
16
        doClear();
17
      }
17
      }
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons57
  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)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    28
    if (size > 0)
    27
    if (size > 0)
    29
    Object[] oldData = delegateToArray();
    29
    Object[] oldData = delegateToArray();
    28
    Object[] oldData = data;
    Differences
    Expression1Expression2Difference
    delegateToArray()dataTYPE_COMPATIBLE_REPLACEMENT
    28
    Object[] oldData = data;
    30
    int oldSize = size;
    29
    int oldSize = size;
    31
    doClear(size, oldData);
    31
    doClear(size, oldData);
    30
    doClear();
    Differences
    Expression1Expression2Difference
    doClear(size,oldData)doClear()ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression doClear(size,oldData) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression doClear(size,oldData) is a void method call, and thus it cannot be parameterized
    Expression doClear() is a void method call, and thus it cannot be parameterized
    30
    doClear();
    32
    NotificationChain notifications = createNotificationChain(oldSize);
    31
    NotificationChain notifications = createNotificationChain(oldSize);
    33
    for (int i = 0; i < oldSize; ++i)
    32
    for (int i = 0; i < oldSize; ++i)
    34
    @SuppressWarnings("unchecked") E object = (E)oldData[i];
    33
    @SuppressWarnings("unchecked") E object = (E)oldData[i];
    35
    notifications = inverseRemove(object, notifications);
    34
    notifications = inverseRemove(object, notifications);
    36
    if (notifications != null)
    35
    if (notifications != null)
    37
    notifications.dispatch();
    36
    notifications.dispatch();
    else
    else
    38
    doClear();
    37
    doClear();
    Precondition Violations (3)
    Row Violation
    1Expression doClear(size,oldData) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression doClear(size,oldData) is a void method call, and thus it cannot be parameterized
    3Expression doClear() is a void method call, and thus it cannot be parameterized