public boolean removeAll(Collection c) {
boolean changed = false;
for (Object object : c) {
changed |= remove(object);
}
return changed;
}
public boolean removeAll(Collection arg0) {
boolean result = false;
for (Iterator iter = arg0.iterator(); iter.hasNext();) {
result = result || remove(iter.next());
}
return result;
}
Clone fragments detected by clone detection tool
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/profile/internal/ocl/uml14/HashBag.java
|
|
File path: /ArgoUML-0.34-src/argouml/src/argouml-app/src/org/argouml/cognitive/ListSet.java
|
Method name: boolean removeAll(Collection)
|
|
Method name: boolean removeAll(Collection)
|
Number of AST nodes: 2
|
|
Number of AST nodes: 2
|
|
1 | public boolean removeAll(Collection c) { | | 1 | public boolean removeAll(Collection arg0) { |
2 | boolean changed = false; | | 2 | boolean result = false; |
3 | for (Object object : c) { | | 3 | for (Iterator iter = arg0.iterator(); iter.hasNext();) { |
4 | changed |= remove(object); | | 4 | result = result || remove(iter.next()); |
5 | } | | 5 | } |
6 | return changed; | | 6 | return result; |
7 | } | | 7 | |
| | | 8 | } |
See real code fragment |
|
See real code fragment |
-
{Non-refactorable}
Mapping Summary
Number of mapped statements | 1 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Similarity Score | 0.667 |
Clone type | Type 2 |
Mapped Statements
ID |
Statement |
|
ID |
Statement |
2 | for (Object object : c) | | 2 | for (Iterator iter = arg0.iterator(); iter.hasNext(); ) |
| | | 3 | result = result || remove(iter.next()); |
3 | changed |= remove(object); | | | |
Precondition Violations (3)
Row |
Violation |
1 | Unmatched statement result=result || remove(iter.next()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement changed|=remove(object); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Clone fragment #1 returns variable object with type java.lang.Object , while Clone fragment #2 returns variable iter with type java.util.Iterator |