String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); String result = StringHelper.join( " or ", StringHelper.suffix( columns, " is not null" ) ); if (columns.length>1) result = '(' + result + ')'; return result;
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); String result = StringHelper.join( " and ", StringHelper.suffix( columns, " is null" ) ); if (columns.length>1) result = '(' + result + ')'; return result;
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/NotNullExpression.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/NullExpression.java
Method name: String toSqlString(Criteria, CriteriaQuery) Method name: String toSqlString(Criteria, CriteriaQuery)
Number of AST nodes: 5 Number of AST nodes: 5
1
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
1
String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
2
		String result = StringHelper.join(
2
		String result = StringHelper.join(
3
			" or ",
3
			" and ",
4
			StringHelper.suffix( columns, " is not null" )
4
			StringHelper.suffix( columns, " is null" )
5
		);
5
		);
6
		if (columns.length>1) result = '(' + result + ')';
6
		if (columns.length>1) result = '(' + result + ')';
7
		return result;
7
		return result;
Summary
Number of common nesting structure subtrees1
Number of refactorable cases1
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.1
Clones locationClones are in different classes
Number of node comparisons13
  1. {Refactorable}
    Mapping Summary
    Number of mapped statements5
    Number of unmapped statements in the first code fragment0
    Number of unmapped statements in the second code fragment0
    Time elapsed for statement mapping (ms)0.8
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
    1
    String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
    2
    String result = StringHelper.join(" or ", StringHelper.suffix(columns, " is not null"));
    2
    String result = StringHelper.join(" or ", StringHelper.suffix(columns, " is not null"));
    2
    String result = StringHelper.join(" and ", StringHelper.suffix(columns, " is null"));
    Differences
    Expression1Expression2Difference
    " or "" and "LITERAL_VALUE_MISMATCH
    " is not null"" is null"LITERAL_VALUE_MISMATCH
    2
    String result = StringHelper.join(" and ", StringHelper.suffix(columns, " is null"));
    3
    if (columns.length > 1)
    3
    if (columns.length > 1)
    4
    result = '(' + result + ')';
    4
    result = '(' + result + ')';
    5
    return result;
    5
    return result;
    Precondition Violations (0)
    Row Violation