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 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/IdentifierEqExpression.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 IdentifierEqExpression implements Criterion {
1
public class NullExpression implements Criterion {
2
	private final Object v
2
	private final String propertyName;
3
alue;
3
	private static final TypedValue[] NO_VALUES = new TypedValue[0];
4
	protected IdentifierEqExpression(Object value) {
4
	protected 
5
		this.value = valu
5
NullExpression(String propertyName) {
6
e;
6
		this.propertyName = propertyName;
7
	}
7
	}
8
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery)
8
	public String toSqlString(Criteria criteria, CriteriaQuery criteriaQuery) 
9
	throws HibernateException {
9
	throws HibernateException {
10
		String[] columns = criteriaQuery.getIdentifierColumns(criteria);
10
		String[] columns = criteriaQuery.getColumnsUsingProjection(criteria, propertyName);
11
		String result = StringHelper.join(
11
		String result = StringHelper.join(
12
			" and ",
12
			" and ",
13
			StringHelper.suffix( columns, " = ?" )
13
			StringHelper.suffix( columns, " is null" )
14
		);
14
		);
15
		if (columns.length>1) result = '(' + result + ')';
15
		if (columns.length>1) result = '(' + result + ')';
16
		return result;
16
		return result;
17
		//TODO: get SQL rendering out of this package!
17
		//TODO: get SQL rendering out of this package!
18
	}
18
	}
19
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery)
19
	public TypedValue[] getTypedValues(Criteria criteria, CriteriaQuery criteriaQuery) 
20
	throws HibernateException {
20
	throws HibernateException {
21
		return new TypedValue[] { criteriaQuery.getTypedIdentifierValue(criteria, value) };
21
		return NO_VALUES;
22
	}
22
	}
23
	public String toString() {
23
	public String toString() {
24
		return "id = " + value;
24
		return propertyName + " is null";
25
	
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