File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/entity/EntityRegionImpl.java | File path: /hibernate-distribution-3.3.2.GA/project/cache-jbosscache2/src/main/java/org/hibernate/cache/jbc2/collection/CollectionRegionImpl.java | |||
Method name: EntityRegionAccessStrategy buildAccessStrategy(AccessType)
|
Method name: CollectionRegionAccessStrategy 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 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.4 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 14 |
Number of mapped statements | 3 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 0.8 |
Clone type | Type 2 |
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); | ||||
2 | return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this); |
| | ||||
3 | if (AccessType.TRANSACTIONAL.equals(accessType)) | 3 | if (AccessType.TRANSACTIONAL.equals(accessType)) | ||||
|
| 4 | return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this); | ||||
4 | 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() + "]"); |
Row | Violation |
---|---|
1 | Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this); |
2 | Unmatched return optimistic ? new OptimisticReadOnlyAccess(this) : new ReadOnlyAccess(this); |
3 | Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this); |
4 | Unmatched return optimistic ? new OptimisticTransactionalAccess(this) : new TransactionalAccess(this); |