File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/Example.java | File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/Example.java | |||
Method name: String toSqlString(Criteria, CriteriaQuery)
|
Method name: void appendComponentCondition(String, Object, AbstractComponentType, Criteria, CriteriaQuery, StringBuffer)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | for (int i=0; i<propertyNames.length; i++) {↵ | 1 | for (int i=0; i<propertyNames.length; i++) {↵ | |
2 | Object propertyValue = propertyValues[i];↵ | 2 | ↵ | |
3 | String propertyName = propertyNames[i];↵ | 3 | String subpath = StringHelper.qualify( path, propertyNames[i] );↵ | |
4 | boolean isPropertyIncluded = i!=meta.getVersionProperty() &&↵ | 4 | ↵ | |
5 | ↵ | 5 | Object value = values[i];↵ | |
6 | isPropertyIncluded( propertyValue, propertyName, propertyTypes[i] );↵ | 6 | if ( isPropertyIncluded( ↵ | |
7 | if (isPropertyIncluded) {↵ | 7 | value, subpath, subtypes[i] ) ) {↵ | |
8 | Type subtype = subtypes[i];↵ | |||
8 | if ( propertyTypes[i].isComponentType() ) {↵ | 9 | if ( subtype.isComponentType() ) {↵ | |
9 | appendComponentCondition(↵ | 10 | appendComponentCondition(↵ | |
10 | propertyName,↵ | 11 | ↵ | |
11 | propertyV↵ | 12 | subpath,↵ | |
12 | alue,↵ | 13 | value,↵ | |
13 | (AbstractComponentType) propertyTypes[i],↵ | 14 | (AbstractComponentType) subtype,↵ | |
14 | criteria,↵ | 15 | criteria,↵ | |
15 | criteriaQuery,↵ | 16 | criteriaQuery,↵ | |
16 | buf↵ | 17 | buf↵ | |
17 | );↵ | 18 | );↵ | |
18 | }↵ | 19 | }↵ | |
19 | else {↵ | 20 | else {↵ | |
20 | appendPropertyCondition(↵ | 21 | appendPropertyCondition(↵ | |
21 | propertyName,↵ | 22 | ↵ | |
22 | propertyV↵ | 23 | subpath,↵ | |
23 | alue,↵ | 24 | value,↵ | |
24 | criteria,↵ | 25 | criteria,↵ | |
25 | criteriaQuery,↵ | 26 | criteriaQuery,↵ | |
26 | buf↵ | 27 | buf↵ | |
27 | );↵ | 28 | );↵ | |
28 | }↵ | 29 | }↵ | |
29 | }↵ | 30 | }↵ | |
30 | } | 31 | } | |
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.3 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 23 |
Number of mapped statements | 7 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 7.7 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6 | for (int i = 0; i < propertyNames.length; i++) | 5 | for (int i = 0; i < propertyNames.length; i++) | ||||||||||||||||||
7 | Object propertyValue = propertyValues[i]; |
| 7 | Object value = values[i]; | |||||||||||||||||
8 | String propertyName = propertyNames[i]; |
| 6 | String subpath = StringHelper.qualify(path, propertyNames[i]); | |||||||||||||||||
9 | boolean isPropertyIncluded = i != meta.getVersionProperty() && isPropertyIncluded(propertyValue, propertyName, propertyTypes[i]); |
| | ||||||||||||||||||
10 | if (isPropertyIncluded) |
| 8 | if (isPropertyIncluded(value, subpath, subtypes[i])) | |||||||||||||||||
|
| 9 | Type subtype = subtypes[i]; | ||||||||||||||||||
11 | if (propertyTypes[i].isComponentType()) |
| 10 | if (subtype.isComponentType()) | |||||||||||||||||
12 | appendComponentCondition(propertyName, propertyValue, (AbstractComponentType)propertyTypes[i], criteria, criteriaQuery, buf); |
| 11 | appendComponentCondition(subpath, value, (AbstractComponentType)subtype, criteria, criteriaQuery, buf); | |||||||||||||||||
else | else | ||||||||||||||||||||
13 | appendPropertyCondition(propertyName, propertyValue, criteria, criteriaQuery, buf); |
| 12 | appendPropertyCondition(subpath, value, criteria, criteriaQuery, buf); |
Row | Violation |
---|---|
1 | Expression propertyNames[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression StringHelper.qualify(path,propertyNames[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement boolean isPropertyIncluded=i != meta.getVersionProperty() && isPropertyIncluded(propertyValue,propertyName,propertyTypes[i]); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression isPropertyIncluded(value,subpath,subtypes[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement Type subtype=subtypes[i]; cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Expression propertyTypes[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression propertyTypes[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Clone fragment #1 returns variables i, propertyValue, propertyName , while Clone fragment #2 returns variables i |