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 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: 8 Number of AST nodes: 7
1
for (int i=0; i<propertyNames.length; i++) {
2
				Object value = values[i];
3
				Type subtype = subtypes[i];
4
				String subpath = StringHelper.qualify( path, propertyNames[i] );
1
String subpath = StringHelper.qualify( path, propertyNames[i] );
5
				
2
				Object value = values[i];
6
if ( isPropertyIncluded(value, subpath, subtype) ) {
3
				if ( isPropertyIncluded( value, subpath, subtypes[i] ) ) {
7
					
4
					Type subtype = subtypes[i];
8
if ( subtype.isComponentType() ) {
5
					if ( subtype.isComponentType() ) {
9
						addComponentTypedValues(subpath, value, 
6
						appendComponentCondition(
7
							subpath,
8
							value,
10
(AbstractComponentType) subtype, list, 
9
							(AbstractComponentType) subtype,
11
criteria, 
10
							criteria,
12
criteriaQuery
11
							criteriaQuery,
12
							buf
13
);
13
						);
14
					}
14
					}
15
					else {
15
					else {
16
						addPropertyTypedValue(value, subtype, list
16
						appendPropertyCondition(
17
							subpath,
18
							value,
19
							criteria,
20
							criteriaQuery,
21
							buf
17
);
22
						);
18
					}
23
					}
19
				}
24
				}
20
			}
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.6
Clones locationClones are declared in the same class
Number of node comparisons18
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements5
    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.0
    Clone typeType 3
    Mapped Statements
    ID Statement ID Statement
    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
    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 (13)
    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
    2Unmatched 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
    3Unmatched 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
    4Unmatched 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
    5Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    6Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    7Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    8Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    9Expression addPropertyTypedValue(value,subtype,list) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    10Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) cannot be parameterized, because it has dependencies to/from statements that will be extracted
    11Expression addPropertyTypedValue(value,subtype,list) is a void method call, and thus it cannot be parameterized
    12Expression appendPropertyCondition(subpath,value,criteria,criteriaQuery,buf) is a void method call, and thus it cannot be parameterized
    13Clone fragment #1 returns variables value, subpath , while Clone fragment #2 returns variables subpath, value