if (start != 0 || end != entries.length)
{
Object [] actualObjects = new Object [collectionSize];
for (int i = 0, j = start; j < end; ++i, ++j)
{
actualObjects[i] = entries[j];
}
notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet);
}
else
{
notification = createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet);
}
if (start != 0 || end != objects.length)
{
Object [] actualObjects = new Object [collectionSize];
for (int i = 0, j = start; j < end; ++i, ++j)
{
actualObjects[i] = objects[j];
}
notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);
}
else
{
notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);
}
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/common/notify/impl/DelegatingNotifyingListImpl.java
|
Method name: boolean addAllUnique(int, FeatureMap.Entry.Internal[], int, int)
|
|
Method name: boolean addAllUnique(int, Object[], int, int)
|
Number of AST nodes: 6
|
|
Number of AST nodes: 6
|
|
1 | if (start != 0 || end != entries.length)↵ | | 1 | if (start != 0 || end != objects.length)↵
|
2 | {↵ | | 2 | {↵
|
3 | Object [] actualObjects = new Object [collectionSize];↵ | | 3 | Object [] actualObjects = new Object [collectionSize];↵
|
4 | for (int i = 0, j = start; j < end; ++i, ++j)↵ | | 4 | for (int i = 0, j = start; j < end; ++i, ++j)↵
|
5 | {↵ | | 5 | {↵
|
6 | actualObjects[i] = entries[j];↵ | | 6 | actualObjects[i] = objects[j];↵
|
7 | }↵ | | 7 | }↵
|
8 | notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet);↵ | | 8 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet);↵
|
9 | }↵ | | 9 | }↵
|
10 | else↵ | | 10 | else↵
|
11 | {↵ | | 11 | {↵
|
12 | notification = createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet);↵ | | 12 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet);↵
|
13 | } | | 13 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 21 |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 3 |
Time elapsed for statement mapping (ms) | 1.8 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
11 | if (start != 0 || end != entries.length) | | 10 | if (start != 0 || end != objects.length) |
12 | Object[] actualObjects = new Object[collectionSize]; | | 11 | Object[] actualObjects = new Object[collectionSize]; |
13 | for (int i = 0, j = start; j < end; ++i, ++j) | | 12 | for (int i = 0, j = start; j < end; ++i, ++j) |
| | | 13 | actualObjects[i] = objects[j]; |
14 | actualObjects[i] = entries[j]; | | | |
| | | 14 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(actualObjects), index, oldIsSet); |
15 | notification = createNotification(Notification.ADD_MANY, null, actualObjects, index, oldIsSet); | | | |
| | | | |
| | | 15 | notification = createNotification(Notification.ADD_MANY, null, Arrays.asList(objects), index, oldIsSet); |
16 | notification = createNotification(Notification.ADD_MANY, null, entries, index, oldIsSet); | | | |
Precondition Violations (4)
Row |
Violation |
1 | Type org.eclipse.emf.ecore.util.FeatureMap.Entry.Internal[] of variable entries does not match with type java.lang.Object[] of variable objects |
2 | Unmatched statement actualObjects[i]=objects[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement actualObjects[i]=entries[j]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Clone fragment #1 returns variables actualObjects, i, j , while Clone fragment #2 returns variables actualObjects, i, j |