if (AccessType.READ_ONLY.equals(accessType)) { return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this); } if (AccessType.TRANSACTIONAL.equals(accessType)) { return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this); } // todo : add support for READ_WRITE ( + NONSTRICT_READ_WRITE ??? ) throw new CacheException("unsupported access type [" + accessType.getName() + "]");
if (AccessType.READ_ONLY.equals(accessType)) { return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this); } if (AccessType.TRANSACTIONAL.equals(accessType)) { return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this); } // todo : add support for READ_WRITE ( + NONSTRICT_READ_WRITE ??? ) throw new CacheException("unsupported access type [" + accessType.getName() + "]");
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/CollectionRegionImpl.java File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/EntityRegionImpl.java
Method name: CollectionRegionAccessStrategy buildAccessStrategy(AccessType) Method name: EntityRegionAccessStrategy buildAccessStrategy(AccessType)
Number of AST nodes: 5 Number of AST nodes: 5
1
if (AccessType.READ_ONLY.equals(accessType)) {
1
if (AccessType.READ_ONLY.equals(accessType)) {
2
            return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
2
            return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
3
        }
3
        }
4
        if (AccessType.TRANSACTIONAL.equals(accessType)) {
4
        if (AccessType.TRANSACTIONAL.equals(accessType)) {
5
            return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
5
            return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
6
        }
6
        }
7
        // todo : add support for READ_WRITE ( + NONSTRICT_READ_WRITE ??? )
7
        // todo : add support for READ_WRITE ( + NONSTRICT_READ_WRITE ??? )
8
        throw new CacheException("unsupported access type [" + accessType.getName() + "]");
8
        throw new CacheException("unsupported access type [" + accessType.getName() + "]");
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.4
Clones locationClones are in different classes having the same super class
Number of node comparisons9
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements2
    Number of unmapped statements in the first code fragment3
    Number of unmapped statements in the second code fragment3
    Time elapsed for statement mapping (ms)8.4
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    1
    if (AccessType.READ_ONLY.equals(accessType))
    1
    if (AccessType.READ_ONLY.equals(accessType))
                                                                                                                                                                              
    2
    return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    Preondition Violations
    Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    2
    return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    2
    return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    2
    return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    Preondition Violations
    Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
                                                                                                                                                                              
                                                                                                        
    3
    if (AccessType.TRANSACTIONAL.equals(accessType))
                                                                                                                                                                                                  
    4
    return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    Preondition Violations
    Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    4
    return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    3
    if (AccessType.TRANSACTIONAL.equals(accessType))
                                                                                                        
    4
    return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    4
    return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    Preondition Violations
    Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
                                                                                                                                                                                                  
    5
    throw new CacheException("unsupported access type [" + accessType.getName() + "]");
    5
    throw new CacheException("unsupported access type [" + accessType.getName() + "]");
    Precondition Violations (4)
    Row Violation
    1Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    2Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this);
    3Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);
    4Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this);