public class NotNullExpression implements Criterion { private final String propertyName; private static final TypedValue[] NO_VALUES = new TypedValue[0]; protected NotNullExpression(String propertyName) { this.propertyName = propertyName; } public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { 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; //TODO: get SQL rendering out of this package! } public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return NO_VALUES; } public String toString() { return propertyName + " is not null"
public class NullExpression implements Criterion { private final String propertyName; private static final TypedValue[] NO_VALUES = new TypedValue[0]; protected NullExpression(String propertyName) { this.propertyName = propertyName; } public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName); String result = StringHelper.join( " and ", StringHelper.suffix( columns, " is null" ) ); if (columns.length>1) result = '(' + result + ')'; return result; //TODO: get SQL rendering out of this package! } public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { return NO_VALUES; } public String toString() { return propertyName + " is null"
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: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class NotNullExpression implements Criterion {
1
public class NullExpression implements Criterion {
2
	private final String propertyName;
2
	private final String propertyName;
3
	private static final TypedValue[] NO_VALUES = new TypedValue[0];
3
	private static final TypedValue[] NO_VALUES = new TypedValue[0];
4
	protected NotNullExpression(String propertyName) {
4
	protected NullExpression(String propertyName) {
5
		this.propertyName = propertyName;
5
		this.propertyName = propertyName;
6
	}
6
	}
7
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
7
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) 
8
	throws HibernateException {
8
	throws HibernateException {
9
		String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
9
		String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
10
		String result = StringHelper.join(
10
		String result = StringHelper.join(
11
			" or ",
11
			" and ",
12
			StringHelper.suffix( columns, " is not null" )
12
			StringHelper.suffix( columns, " is null" )
13
		);
13
		);
14
		if (columns.length>1) result = '(' + result + ')';
14
		if (columns.length>1) result = '(' + result + ')';
15
		return result;
15
		return result;
16
		//TODO: get SQL rendering out of this package!
16
		//TODO: get SQL rendering out of this package!
17
	}
17
	}
18
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
18
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) 
19
	throws HibernateException {
19
	throws HibernateException {
20
		return NO_VALUES;
20
		return NO_VALUES;
21
	}
21
	}
22
	public String toString() {
22
	public String toString() {
23
		return propertyName + " is not null"
23
		return propertyName + " is null"
Summary
Number of common nesting structure subtrees0
Number of refactorable cases0
Number of non-refactorable cases0
Time elapsed for finding largest common nesting structure subtrees (ms)0.0
Clones location
Number of node comparisons0