Boolean exists = isPutQueueEnabled() ? readElementExistence(value) : null; if ( exists == null ) { initialize( true ); if ( list.remove( value ) ) { dirty(); return true; } else { return false; } } else if ( exists.booleanValue() ) { queueOperation( new SimpleRemove(value) ); return true; } else { return false; }
Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null; if ( exists==null ) { initialize( true ); if ( set.remove( value ) ) { dirty(); return true; } else { return false; } } else if ( exists.booleanValue() ) { queueOperation( new SimpleRemove(value) ); return true; } else { return false; }
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentList.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/collection/PersistentSet.java
Method name: boolean remove(Object) Method name: boolean remove(Object)
Number of AST nodes: 11 Number of AST nodes: 11
1
Boolean exists = isPutQueueEnabled() ? readElementExistence(value) : null;
1
Boolean exists = isPutQueueEnabled() ? readElementExistence( value ) : null;
2
		if ( exists == null ) {
2
		if ( exists==null ) {
3
			initialize( true );
3
			initialize( true );
4
			if ( list.remove( value ) ) {
4
			if ( set.remove( value ) ) {
5
				dirty();
5
				dirty();
6
				return true;
6
				return true;
7
			}
7
			}
8
			else {
8
			else {
9
				return false;
9
				return false;
10
			}
10
			}
11
		}
11
		}
12
		else if ( exists.booleanValue() ) {
12
		else if ( exists.booleanValue() ) {
13
			queueOperation( new SimpleRemove(value) );
13
			queueOperation( new SimpleRemove(value) );
14
			return true;
14
			return true;
15
		}
15
		}
16
		else {
16
		else {
17
			return false;
17
			return false;
18
		}
18
		}
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.3
Clones locationClones are in different classes having the same super class
Number of node comparisons37
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements11
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)1.4
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    Boolean exists = isPutQueueEnabled() ? readElementExistence(value) : null;
    1
    Boolean exists = isPutQueueEnabled() ? readElementExistence(value) : null;
    2
    if (exists == null)
    2
    if (exists == null)
    3
    initialize(true);
    3
    initialize(true);
    4
    if (list.remove(value))
    4
    if (list.remove(value))
    4
    if (set.remove(value))
    Differences
    Expression1Expression2Difference
    listsetVARIABLE_NAME_MISMATCH
    java.util.Listjava.util.SetVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type java.util.List of variable list does not match with type java.util.Set of variable set
    • Make classes java.util.List and java.util.Set extend a common superclass
    4
    if (set.remove(value))
    5
    dirty();
    5
    dirty();
    6
    return true;
    6
    return true;
    else
    else
    7
    return false;
    7
    return false;
    8
    else if (exists.booleanValue())
    8
    else if (exists.booleanValue())
    9
    queueOperation(new SimpleRemove(value));
    9
    queueOperation(new SimpleRemove(value));
    9
    queueOperation(new SimpleRemove(value));
    Differences
    Expression1Expression2Difference
    org.hibernate.collection.PersistentList.SimpleRemoveorg.hibernate.collection.PersistentSet.SimpleRemoveVARIABLE_TYPE_MISMATCH
    Preondition Violations
    Type org.hibernate.collection.PersistentList.SimpleRemove of variable new SimpleRemove(value) does not match with type org.hibernate.collection.PersistentSet.SimpleRemove of variable new SimpleRemove(value)
    • Make classes org.hibernate.collection.PersistentList.SimpleRemove and org.hibernate.collection.PersistentSet.SimpleRemove extend a common superclass
    9
    queueOperation(new SimpleRemove(value));
    10
    return true;
    10
    return true;
    else
    else
    11
    return false;
    11
    return false;
    Precondition Violations (2)
    Row Violation
    1Type java.util.List of variable list does not match with type java.util.Set of variable set
    2Type org.hibernate.collection.PersistentList.SimpleRemove of variable new SimpleRemove(value) does not match with type org.hibernate.collection.PersistentSet.SimpleRemove of variable new SimpleRemove(value)