File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/TypeFactory.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/TypeFactory.java | |||
Method name: int[] findModified(StandardProperty[], Object[], Object[], boolean[][], boolean, SessionImplementor)
|
Method name: int[] findDirty(StandardProperty[], Object[], Object[], boolean[][], boolean, SessionImplementor)
|
|||
Number of AST nodes: 14 | Number of AST nodes: 14 | |||
1 | int[] results = null;↵ | 1 | int[] results = null;↵ | |
2 | int count = 0;↵ | 2 | int count = 0;↵ | |
3 | int span = properties.length;↵ | 3 | int span = properties.length;↵ | |
4 | for ( int i = 0; i < span; i++ ) {↵ | 4 | for ( int i = 0; i < span; i++ ) {↵ | |
5 | final boolean modified = currentState[i]!=LazyPropertyInitializer.UNFETCHED_PROPERTY↵ | 5 | final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY↵ | |
6 | && properties[i].isDirtyCheckable(anyUninitializedProperties)↵ | 6 | && properties[i].isDirtyCheckable( anyUninitializedProperties )↵ | |
7 | && properties[i].getType().isModified( previousState[i], currentState[i], includeColumns[i], session );↵ | 7 | && properties[i].getType().isDirty( previousState[i], currentState[i], includeColumns[i], session );↵ | |
8 | if ( modified ) {↵ | 8 | if ( dirty ) {↵ | |
9 | if ( results == null ) {↵ | 9 | if ( results == null ) {↵ | |
10 | results = new int[span];↵ | 10 | results = new int[span];↵ | |
11 | }↵ | 11 | }↵ | |
12 | results[count++] = i;↵ | 12 | results[count++] = i;↵ | |
13 | }↵ | 13 | }↵ | |
14 | }↵ | 14 | }↵ | |
15 | if ( count == 0 ) {↵ | 15 | if ( count == 0 ) {↵ | |
16 | return null;↵ | 16 | return null;↵ | |
17 | }↵ | 17 | }↵ | |
18 | else {↵ | 18 | else {↵ | |
19 | int[] trimmed = new int[count];↵ | 19 | int[] trimmed = new int[count];↵ | |
20 | System.arraycopy( results, 0, trimmed, 0, count );↵ | 20 | System.arraycopy( results, 0, trimmed, 0, count );↵ | |
21 | return trimmed;↵ | 21 | return trimmed;↵ | |
22 | } | 22 |
| |
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.8 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 46 |
Number of mapped statements | 14 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 7.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | int[] results = null; | 1 | int[] results = null; | ||||||||||||||||
2 | int count = 0; | 2 | int count = 0; | ||||||||||||||||
3 | int span = properties.length; | 3 | int span = properties.length; | ||||||||||||||||
4 | for (int i = 0; i < span; i++) | 4 | for (int i = 0; i < span; i++) | ||||||||||||||||
5 | final boolean modified = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isModified(previousState[i], currentState[i], includeColumns[i], session); |
| 5 | final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY && properties[i].isDirtyCheckable(anyUninitializedProperties) && properties[i].getType().isDirty(previousState[i], currentState[i], includeColumns[i], session); | |||||||||||||||
6 | if (modified) |
| 6 | if (dirty) | |||||||||||||||
7 | if (results == null) | 7 | if (results == null) | ||||||||||||||||
8 | results = new int[span]; | 8 | results = new int[span]; | ||||||||||||||||
9 | results[count++] = i; | 9 | results[count++] = i; | ||||||||||||||||
10 | if (count == 0) | 10 | if (count == 0) | ||||||||||||||||
11 | return null; | 11 | return null; | ||||||||||||||||
else | else | ||||||||||||||||||
12 | int[] trimmed = new int[count]; | 12 | int[] trimmed = new int[count]; | ||||||||||||||||
13 | System.arraycopy(results, 0, trimmed, 0, count); | 13 | System.arraycopy(results, 0, trimmed, 0, count); | ||||||||||||||||
14 | return trimmed; | 14 | return trimmed; |
Row | Violation |
---|---|
1 | Expression properties[i].getType().isModified(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression properties[i].getType().isDirty(previousState[i],currentState[i],includeColumns[i],session) cannot be parameterized, because it has dependencies to/from statements that will be extracted |