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: void addComponentTypedValues(String, Object, AbstractComponentType, List, Criteria, CriteriaQuery)
|
Method name: void appendComponentCondition(String, Object, AbstractComponentType, Criteria, CriteriaQuery, StringBuffer)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 11 | |||
1 | if (component!=null) {↵ | |||
2 | String[] propertyNames = type.getPropertyNames();↵ | 1 | String[] propertyNames = type.getPropertyNames();↵ | |
3 | Type[] subtypes = type.getSubtypes();↵ | 2 | ↵ | |
4 | Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) );↵ | 3 | Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) );↵ | |
5 | ↵ | 4 | Type[] subtypes = type.getSubtypes();↵ | |
6 | for (int i=0; i<propertyNames.length; i++) {↵ | 5 | for (int i=0; i<propertyNames.length; i++) {↵ | |
7 | Object value = values[i];↵ | 6 | ↵ | |
8 | Type subtype = subtypes[i];↵ | |||
9 | String subpath = StringHelper.qualify( path, propertyNames[i] );↵ | 7 | String subpath = StringHelper.qualify( path, propertyNames[i] );↵ | |
10 | ↵ | 8 | Object value = values[i];↵ | |
11 | if ( isPropertyIncluded(value, subpath, subtype) ) {↵ | 9 | if ( isPropertyIncluded( value, subpath, subtypes[i] ) ) {↵ | |
12 | ↵ | 10 | Type subtype = subtypes[i];↵ | |
13 | if ( subtype.isComponentType() ) {↵ | 11 | if ( subtype.isComponentType() ) {↵ | |
14 | addComponentTypedValues(subpath, value, ↵ | 12 | appendComponentCondition(↵ | |
13 | subpath,↵ | |||
14 | value,↵ | |||
15 | (AbstractComponentType) subtype, list, ↵ | 15 | (AbstractComponentType) subtype,↵ | |
16 | criteria, ↵ | 16 | criteria,↵ | |
17 | criteriaQuery↵ | 17 | criteriaQuery,↵ | |
18 | buf↵ | |||
18 | );↵ | 19 | );↵ | |
19 | }↵ | 20 | }↵ | |
20 | else {↵ | 21 | else {↵ | |
21 | addPropertyTypedValue(value, subtype, list↵ | 22 | appendPropertyCondition(↵ | |
23 | subpath,↵ | |||
24 | value,↵ | |||
25 | criteria,↵ | |||
26 | criteriaQuery,↵ | |||
27 | buf↵ | |||
22 | );↵ | 28 | );↵ | |
23 | }↵ | 29 | }↵ | |
24 | }↵ | 30 | }↵ | |
25 | }↵ | 31 |
| |
26 | } | |||
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 | 33 |
Number of mapped statements | 9 |
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) | 2.6 |
Clone type | Type 3 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | String[] propertyNames = type.getPropertyNames(); | 2 | String[] propertyNames = type.getPropertyNames(); | ||||||||||||||||||||||
3 | Type[] subtypes = type.getSubtypes(); | 4 | Type[] subtypes = type.getSubtypes(); | ||||||||||||||||||||||
4 | Object[] values = type.getPropertyValues(component, getEntityMode(criteria, criteriaQuery)); | 3 | Object[] values = type.getPropertyValues(component, getEntityMode(criteria, criteriaQuery)); | ||||||||||||||||||||||
5 | for (int i = 0; i < propertyNames.length; i++) | 5 | for (int i = 0; i < propertyNames.length; i++) | ||||||||||||||||||||||
6 | Object value = values[i]; | 7 | Object value = values[i]; | ||||||||||||||||||||||
7 | Type subtype = subtypes[i]; |
| | ||||||||||||||||||||||
8 | String subpath = StringHelper.qualify(path, propertyNames[i]); | 6 | String subpath = StringHelper.qualify(path, propertyNames[i]); | ||||||||||||||||||||||
9 | if (isPropertyIncluded(value, subpath, subtype)) |
| 8 | if (isPropertyIncluded(value, subpath, subtypes[i])) | |||||||||||||||||||||
|
| 9 | Type subtype = subtypes[i]; | ||||||||||||||||||||||
10 | if (subtype.isComponentType()) | 10 | if (subtype.isComponentType()) | ||||||||||||||||||||||
|
| 11 | appendComponentCondition(subpath, value, (AbstractComponentType)subtype, criteria, criteriaQuery, buf); | ||||||||||||||||||||||
11 | addComponentTypedValues(subpath, value, (AbstractComponentType)subtype, list, criteria, criteriaQuery); |
| | ||||||||||||||||||||||
else | else | ||||||||||||||||||||||||
12 | addPropertyTypedValue(value, subtype, list); |
| 12 | appendPropertyCondition(subpath, value, criteria, criteriaQuery, buf); |
Row | Violation |
---|---|
1 | 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 |
2 | Expression 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 | Unmatched statement appendComponentCondition(subpath,value,(AbstractComponentType)subtype,criteria,criteriaQuery,buf); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
5 | Unmatched statement addComponentTypedValues(subpath,value,(AbstractComponentType)subtype,list,criteria,criteriaQuery); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
6 | Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized |
9 | Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized |
10 | Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
12 | Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized |
13 | Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized |
14 | Clone fragment #1 returns variables subtypes, i, value, subpath , while Clone fragment #2 returns variables subtypes, i, subpath, value |