LOOP: for (int repeat = 0; repeat < 2; ++repeat) { for (int j = listSize; --j >= 0; ) { if (equalObjects(object, objects[j])) { if (positions.length <= count) { int [] oldPositions = positions; positions = new int [2 * positions.length]; System.arraycopy(oldPositions, 0, positions, 0, count); } positions[count++] = i.previousIndex(); resultList.add(objects[j]); break LOOP; } } object = resolve(object); if (object == initialObject) { break; } }
LOOP: for (int repeat = 0; repeat < 2; ++repeat) { for (int j = listSize; --j >= 0; ) { if (equalObjects(object, objects[j])) { if (positions.length <= count) { int [] oldPositions = positions; positions = new int [2 * positions.length]; System.arraycopy(oldPositions, 0, positions, 0, count); } positions[count++] = i; resultList.add(objects[j]); break LOOP; } } object = resolve(object); if (object == initialObject) { break; } }
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: boolean removeAll(Collection) Method name: boolean removeAll(Collection)
Number of AST nodes: 14 Number of AST nodes: 14
1
LOOP:
1
LOOP:
2
            for (int repeat = 0; repeat < 2; ++repeat)
2
            for (int repeat = 0; repeat < 2; ++repeat)
3
            {
3
            {
4
              for (int j = listSize; --j >= 0; )
4
              for (int j = listSize; --j >= 0; )
5
              {
5
              {
6
                if (equalObjects(object, objects[j]))
6
                if (equalObjects(object, objects[j]))
7
                {
7
                {
8
                  if (positions.length <= count)
8
                  if (positions.length <= count)
9
                  {
9
                  {
10
                    int [] oldPositions = positions;
10
                    int [] oldPositions = positions;
11
                    positions = new int [2 * positions.length];
11
                    positions = new int [2 * positions.length];
12
                    System.arraycopy(oldPositions, 0, positions, 0, count);
12
                    System.arraycopy(oldPositions, 0, positions, 0, count);
13
                  }
13
                  }
14
                  positions[count++] = i.previousIndex();
14
                  positions[count++] = i;
15
                  resultList.add(objects[j]);
15
                  resultList.add(objects[j]);
16
                  break LOOP;
16
                  break LOOP;
17
                }
17
                }
18
              }
18
              }
19
              object = resolve(object);
19
              object = resolve(object);
20
              if (object == initialObject)
20
              if (object == initialObject)
21
              {
21
              {
22
                break;
22
                break;
23
              }
23
              }
24
            }
24
            }
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.6
Clones locationClones are in different classes having the same super class
Number of node comparisons66
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements13
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)5.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    32
    for (int repeat = 0; repeat < 2; ++repeat)
    32
    for (int repeat = 0; repeat < 2; ++repeat)
    33
    for (int j = listSize; --j >= 0; )
    33
    for (int j = listSize; --j >= 0; )
    34
    if (equalObjects(object, objects[j]))
    34
    if (equalObjects(object, objects[j]))
    35
    if (positions.length <= count)
    35
    if (positions.length <= count)
    36
    int[] oldPositions = positions;
    36
    int[] oldPositions = positions;
    37
    positions = new int[2 * positions.length];
    37
    positions = new int[2 * positions.length];
    38
    System.arraycopy(oldPositions, 0, positions, 0, count);
    38
    System.arraycopy(oldPositions, 0, positions, 0, count);
    39
    positions[count++] = i.previousIndex();
    39
    positions[count++] = i.previousIndex();
    39
    positions[count++] = i;
    Differences
    Expression1Expression2Difference
    i.previousIndex()iTYPE_COMPATIBLE_REPLACEMENT
    39
    positions[count++] = i;
    40
    resultList.add(objects[j]);
    40
    resultList.add(objects[j]);
    41
    break LOOP;
    41
    break LOOP;
    42
    object = resolve(object);
    42
    object = resolve(object);
    43
    if (object == initialObject)
    43
    if (object == initialObject)
    44
    break;
    44
    break;
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables count, positions , while Clone fragment #2 returns variables count, positions