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: 7 | Number of AST nodes: 7 | |||
1 | Object propertyValue = propertyValues[i];↵ | |||
2 | String propertyName = propertyNames[i];↵ | 1 | String subpath = StringHelper.qualify( path, propertyNames[i] );↵ | |
3 | boolean isPropertyIncluded = i!=meta.getVersionProperty() &&↵ | 2 | ↵ | |
4 | ↵ | 3 | Object value = values[i];↵ | |
5 | isPropertyIncluded( propertyValue, propertyName, propertyTypes[i] );↵ | 4 | if ( isPropertyIncluded( ↵ | |
6 | if (isPropertyIncluded) {↵ | 5 | value, subpath, subtypes[i] ) ) {↵ | |
6 | Type subtype = subtypes[i];↵ | |||
7 | if ( propertyTypes[i].isComponentType() ) {↵ | 7 | if ( subtype.isComponentType() ) {↵ | |
8 | appendComponentCondition(↵ | 8 | appendComponentCondition(↵ | |
9 | propertyName,↵ | 9 | ↵ | |
10 | propertyV↵ | 10 | subpath,↵ | |
11 | alue,↵ | 11 | value,↵ | |
12 | (AbstractComponentType) propertyTypes[i],↵ | 12 | (AbstractComponentType) subtype,↵ | |
13 | criteria,↵ | 13 | criteria,↵ | |
14 | criteriaQuery,↵ | 14 | criteriaQuery,↵ | |
15 | buf↵ | 15 | buf↵ | |
16 | );↵ | 16 | );↵ | |
17 | }↵ | 17 | }↵ | |
18 | else {↵ | 18 | else {↵ | |
19 | appendPropertyCondition(↵ | 19 | appendPropertyCondition(↵ | |
20 | propertyName,↵ | 20 | ↵ | |
21 | propertyV↵ | 21 | subpath,↵ | |
22 | alue,↵ | 22 | value,↵ | |
23 | criteria,↵ | 23 | criteria,↵ | |
24 | criteriaQuery,↵ | 24 | criteriaQuery,↵ | |
25 | buf↵ | 25 | buf↵ | |
26 | );↵ | 26 | );↵ | |
27 | }↵ | 27 | }↵ | |
28 | } | 28 | } | |
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 declared in the same class |
Number of node comparisons | 18 |
Number of mapped statements | 6 |
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.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | |||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
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 | 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 |
2 | Expression isPropertyIncluded(value,subpath,subtypes[i]) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | 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 |
4 | Clone fragment #1 returns variables propertyValue, propertyName , while Clone fragment #2 returns variables |