File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/engine/BatchFetchQueue.java | |||
Method name: Serializable[] getCollectionBatch(CollectionPersister, Serializable, int, EntityMode)
|
Method name: Serializable[] getEntityBatch(EntityPersister, Serializable, int, EntityMode)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | if ( !collection.wasInitialized() && ce.getLoadedPersister() == collectionPersister ) {↵ | |||
1 | EntityKey key = (EntityKey) iter.next();↵ | |||
2 | if ( key.getEntityName().equals( persister.getEntityName() ) ) { //TODO: this needn't exclude subclasses...↵ | |||
2 | if ( checkForEnd && i == end ) {↵ | 3 | if ( checkForEnd && i == end ) {↵ | |
3 | return keys; //the first key found after the given key↵ | 4 | //the first id found after the given id↵ | |
4 | }↵ | 5 | ↵ | |
5 | //if ( end == -1 && count > batchSize*10 ) return keys; //try out ten batches, max↵ | |||
6 | final boolean isEqual = collectionP↵ | 6 | return ids;↵ | |
7 | }↵ | |||
7 | ersister.getKeyType().isEqual(↵ | 8 | if ( persister.getIdentifierType().isEqual(↵ | |
8 | id,↵ | |||
9 | ce.getLoadedKey(),↵ | |||
10 | entityMode,↵ | |||
11 | collectionPersister.getFactory()↵ | |||
12 | );↵ | |||
13 | if ( isEqual ) {↵ | |||
14 | end = i;↵ | |||
15 | //checkForEnd = false↵ | 9 | id, key.getIdentifier(), entityMode ) ) {↵ | |
16 | ;↵ | 10 | end = i;↵ | |
17 | }↵ | 11 | }↵ | |
18 | else ↵ | 12 | else {↵ | |
19 | if ( !isCached( ce.getLoadedKey(), collectionPersister, entityMode ) ) {↵ | 13 | if ( !isCached( key, persister, entityMode ) ) {↵ | |
20 | keys[i++] = ce.getLoadedKey();↵ | 14 | ids[i++] = key.get↵ | |
21 | //count++;↵ | 15 | Identifier();↵ | |
16 | }↵ | |||
22 | }↵ | 17 | }↵ | |
23 | if ( i == batchSize ) {↵ | 18 | if ( i == batchSize ) {↵ | |
24 | i = 1; //end of array, start filling again from start↵ | 19 | i = 1; //end of array, start filling again from start↵ | |
25 | if ( end != -1 ) {↵ | 20 | if (end!=-1) ↵ | |
26 | checkForEnd = true;↵ | 21 | checkForEnd = true;↵ | |
27 | }↵ | 22 | ↵ | |
28 | }↵ | 23 | }↵ | |
29 | } | 24 |
| |
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.5 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 26 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 3 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.4 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
12 | if (checkForEnd && i == end) | 10 | if (checkForEnd && i == end) | |||||||||||
13 | return keys; |
| 11 | return ids; | ||||||||||
14 | final boolean isEqual = collectionPersister.getKeyType().isEqual(id, ce.getLoadedKey(), entityMode, collectionPersister.getFactory()); |
| | |||||||||||
15 | if (isEqual) |
| 12 | if (persister.getIdentifierType().isEqual(id, key.getIdentifier(), entityMode)) | ||||||||||
16 | end = i; | 13 | end = i; | |||||||||||
| 14 | if (!isCached(key, persister, entityMode)) | ||||||||||||
|
| 15 | ids[i++] = key.getIdentifier(); | |||||||||||
17 | else if (!isCached(ce.getLoadedKey(), collectionPersister, entityMode)) | | ||||||||||||
18 | keys[i++] = ce.getLoadedKey(); |
| | |||||||||||
19 | if (i == batchSize) | 16 | if (i == batchSize) | |||||||||||
20 | i = 1; | 17 | i = 1; | |||||||||||
21 | if (end != -1) | 18 | if (end != -1) | |||||||||||
22 | checkForEnd = true; | 19 | checkForEnd = true; |
Row | Violation |
---|---|
1 | Unmatched statement final boolean isEqual=collectionPersister.getKeyType().isEqual(id,ce.getLoadedKey(),entityMode,collectionPersister.getFactory()); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
2 | Unmatched statement ids[i++]=key.getIdentifier(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement keys[i++]=ce.getLoadedKey(); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Clone fragment #1 returns variables i, end, checkForEnd , while Clone fragment #2 returns variables i, end, checkForEnd |