boolean modified = false; for (ListIterator<?> i = listIterator(); i.hasNext(); ) { if (!collection.contains(i.next())) { i.remove(); modified = true; } } return modified;
boolean modified = false; for (ListIterator<?> i = listIterator(); i.hasNext(); ) { if (collection.contains(i.next())) { i.remove(); modified = true; } } return modified;
Clone fragments detected by clone detection tool
File path: /emf-2.4.1/src/org/eclipse/emf/common/util/DelegatingEList.java File path: /emf-2.4.1/src/org/eclipse/emf/common/util/DelegatingEList.java
Method name: boolean retainAll(Collection) Method name: boolean removeAll(Collection)
Number of AST nodes: 6 Number of AST nodes: 6
1
boolean modified = false;
1
boolean modified = false;
2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
3
    {
3
    {
4
      if (!collection.contains(i.next()))
4
      if (collection.contains(i.next()))
5
      {
5
      {
6
        i.remove();
6
        i.remove();
7
        modified = true;
7
        modified = true;
8
      }
8
      }
9
    }
9
    }
10
    return modified;
10
    return modified;
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.2
Clones locationClones are declared in the same class
Number of node comparisons14
  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)2098.0
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    boolean modified = false;
    1
    boolean modified = false;
    2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
    2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
    2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
    Differences
    Expression1Expression2Difference
    java.util.ListIterator<>java.util.ListIterator<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.ListIterator<> of variable i does not match with type java.util.ListIterator<> of variable i
    • Make classes java.util.ListIterator<> and java.util.ListIterator<> extend a common superclass
    2
    for (ListIterator<?> i = listIterator(); i.hasNext(); )
    3
    if (!collection.contains(i.next()))
    3
    if (!collection.contains(i.next()))
    3
    if (collection.contains(i.next()))
    Differences
    Expression1Expression2Difference
    !collection.contains(i.next())collection.contains(i.next())TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression !collection.contains(i.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression collection.contains(i.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3
    if (collection.contains(i.next()))
    4
    i.remove();
    4
    i.remove();
    4
    i.remove();
    Differences
    Expression1Expression2Difference
    java.util.ListIterator<>java.util.ListIterator<>VARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.ListIterator<> of variable i does not match with type java.util.ListIterator<> of variable i
    • Make classes java.util.ListIterator<> and java.util.ListIterator<> extend a common superclass
    4
    i.remove();
    5
    modified = true;
    5
    modified = true;
    6
    return modified;
    6
    return modified;
    Precondition Violations (4)
    Row Violation
    1Type java.util.ListIterator<> of variable i does not match with type java.util.ListIterator<> of variable i
    2Expression !collection.contains(i.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Expression collection.contains(i.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4Type java.util.ListIterator<> of variable i does not match with type java.util.ListIterator<> of variable i