if (component!=null) { String[] propertyNames = type.getPropertyNames(); Type[] subtypes = type.getSubtypes(); Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) ); for (int i=0; i<propertyNames.length; i++) { Object value = values[i]; Type subtype = subtypes[i]; String subpath = StringHelper.qualify( path, propertyNames[i] ); if ( isPropertyIncluded(value, subpath, subtype) ) { if ( subtype.isComponentType() ) { addComponentTypedValues(subpath, value, (AbstractComponentType) subtype, list, criteria, criteriaQuery); } else { addPropertyTypedValue(value, subtype, list); } } } }
String[] propertyNames = type.getPropertyNames(); Object[] values = type.getPropertyValues( component, getEntityMode(criteria, criteriaQuery) ); Type[] subtypes = type.getSubtypes(); for (int i=0; i<propertyNames.length; i++) { String subpath = StringHelper.qualify( path, propertyNames[i] ); Object value = values[i]; if ( isPropertyIncluded( value, subpath, subtypes[i] ) ) { Type subtype = subtypes[i]; if ( subtype.isComponentType() ) { appendComponentCondition( subpath, value, (AbstractComponentType) subtype, criteria, criteriaQuery, buf ); } else { appendPropertyCondition( subpath, value, criteria, criteriaQuery, buf ); } } }
Clone fragments detected by clone detection tool
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
		}
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.4
Clones locationClones are declared in the same class
Number of node comparisons33
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements9
    Number of unmapped statements in the first code fragment2
    Number of unmapped statements in the second code fragment2
    Time elapsed for statement mapping (ms)2.6
    Clone typeType 3
    Mapped Statements
    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];
    7
    Type subtype = subtypes[i];
    Preondition Violations
    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
                                                            
    8
    String subpath = StringHelper.qualify(path, propertyNames[i]);
    6
    String subpath = StringHelper.qualify(path, propertyNames[i]);
    9
    if (isPropertyIncluded(value, subpath, subtype))
    9
    if (isPropertyIncluded(value, subpath, subtype))
    8
    if (isPropertyIncluded(value, subpath, subtypes[i]))
    Differences
    Expression1Expression2Difference
    subtypesubtypes[i]TYPE_COMPATIBLE_REPLACEMENT
    Preondition Violations
    Expression subtypes[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8
    if (isPropertyIncluded(value, subpath, subtypes[i]))
                                                            
    9
    Type subtype = subtypes[i];
    Preondition Violations
    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
    9
    Type subtype = subtypes[i];
    10
    if (subtype.isComponentType())
    10
    if (subtype.isComponentType())
                                                                                                                                                                                                                
    11
    appendComponentCondition(subpath, value, (AbstractComponentType)subtype, criteria, criteriaQuery, buf);
    Preondition Violations
    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
    11
    appendComponentCondition(subpath, value, (AbstractComponentType)subtype, criteria, criteriaQuery, buf);
    11
    addComponentTypedValues(subpath, value, (AbstractComponentType)subtype, list, criteria, criteriaQuery);
    11
    addComponentTypedValues(subpath, value, (AbstractComponentType)subtype, list, criteria, criteriaQuery);
    Preondition Violations
    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
                                                                                                                                                                                                                
    else
    else
    12
    addPropertyTypedValue(value, subtype, list);
    12
    addPropertyTypedValue(value, subtype, list);
    12
    appendPropertyCondition(subpath, value, criteria, criteriaQuery, buf);
    Differences
    Expression1Expression2Difference
    addPropertyTypedValueappendPropertyConditionMETHOD_INVOCATION_NAME_MISMATCH
    addPropertyTypedValue(value,subtype,list)appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf)ARGUMENT_NUMBER_MISMATCH
    Preondition Violations
    Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    12
    appendPropertyCondition(subpath, value, criteria, criteriaQuery, buf);
    Precondition Violations (14)
    Row Violation
    1Unmatched 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
    2Expression subtypes[i] cannot be parameterized, because it has dependencies to/from statements that will be extracted
    3Unmatched 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
    4Unmatched 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
    5Unmatched 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
    6Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    8Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    9Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    10Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    12Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    13Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    14Clone fragment #1 returns variables subtypes, i, value, subpath , while Clone fragment #2 returns variables subtypes, i, subpath, value