public class IdentifierEqExpression implements Criterion { private final Object value; protected IdentifierEqExpression(Object value) { this.value = value; } public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) throws HibernateException { String[] columns = criteriaQuery.getIdentifierColumns(criteria); String result = StringHelper.join( " and ", StringHelper.suffix( columns, " = ?" ) ); 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 new TypedValue[] { criteriaQuery.getTypedIdentifierValue(criteria, value) }; } public String toString() { return "id = " + value;
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";
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/IdentifierEqExpression.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/criterion/NotNullExpression.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class IdentifierEqExpression implements Criterion {
1
public class NotNullExpression implements Criterion {
2
	private final Object value;
2
	private final 
3
	protected IdentifierEqExpression(Object value) {
4
		this.value = valu
3
String propertyName;
4
	private static final TypedValue[] NO_VALUES = new TypedValue[0];
5
	protected NotNullExpression(String propertyName) {
5
e;
6
		this.propertyName = propertyName;
6
	}
7
	}
7
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
8
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
8
	throws HibernateException {
9
	throws HibernateException {
9
		String[] columns = criteriaQuery.getIdentifierColumns(criteria);
10
		String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
10
		String result = StringHelper.join(
11
		String result = StringHelper.join(
11
			" and ",
12
			" or ",
12
			StringHelper.suffix( columns, " = ?" )
13
			StringHelper.suffix( columns, " is not null" )
13
		);
14
		);
14
		if (columns.length>1) result = '(' + result + ')';
15
		if (columns.length>1) result = '(' + result + ')';
15
		return result;
16
		return result;
16
		//TODO: get SQL rendering out of this package!
17
		//TODO: get SQL rendering out of this package!
17
	}
18
	}
18
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
19
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
19
	throws HibernateException {
20
	throws HibernateException {
20
		return new TypedValue[] { criteriaQuery.getTypedIdentifierValue(criteria, value) };
21
		return NO_VALUES;
21
	}
22
	}
22
	public String toString() {
23
	public String toString() {
23
		return "id = " + value;
24
		return propertyName + " is not null";
24
	
25
	
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