Iterator it = c.iterator(); boolean changed = false; while ( it.hasNext() ) { if ( this.add( it.next() ) ) { changed = true; } } return changed;
Iterator it = c.iterator(); boolean changed = false; while ( it.hasNext() ) { if ( this.remove( it.next() ) ) { changed = true; } } return changed;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/IdentitySet.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/util/IdentitySet.java
Method name: boolean addAll(Collection) Method name: boolean removeAll(Collection)
Number of AST nodes: 6 Number of AST nodes: 6
1
Iterator it = c.iterator();
1
Iterator it = c.iterator();
2
		boolean changed = false;
2
		boolean changed = false;
3
		while ( it.hasNext() ) {
3
		while ( it.hasNext() ) {
4
			if ( this.add( it.next() ) ) {
4
			if ( this.remove( it.next() ) ) {
5
				changed = true;
5
				changed = true;
6
			}
6
			}
7
		}
7
		}
8
		return changed;
8
		return changed;
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)0.7
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Iterator it = c.iterator();
    1
    Iterator it = c.iterator();
    2
    boolean changed = false;
    2
    boolean changed = false;
    3
    while (it.hasNext())
    3
    while (it.hasNext())
    4
    if (this.add(it.next()))
    4
    if (this.add(it.next()))
    4
    if (this.remove(it.next()))
    Differences
    Expression1Expression2Difference
    addremoveMETHOD_INVOCATION_NAME_MISMATCH
    Preondition Violations
    Expression this.add(it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression this.remove(it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    4
    if (this.remove(it.next()))
    5
    changed = true;
    5
    changed = true;
    6
    return changed;
    6
    return changed;
    Precondition Violations (2)
    Row Violation
    1Expression this.add(it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    2Expression this.remove(it.next()) cannot be parameterized, because it has dependencies to/from statements that will be extracted