public class IntegerType extends PrimitiveType implements DiscriminatorType, VersionType { private static final Integer ZERO = new Integer(0); public Serializable getDefaultValue() { return ZERO; } public Object get(ResultSet rs, String name) throws SQLException { return new Integer( rs.getInt(name) ); } public Class getPrimitiveClass() { return int.class; } public Class getReturnedClass() { return Integer.class; } public void set(PreparedStatement st, Object value, int index) throws SQLException { st.setInt( index, ( (Integer) value ).intValue() ); } public int sqlType() { return Types.INTEGER; } public String getName() { return "integer"; } public String objectToSQLString(Object value, Dialect dialect) throws Exception { return value.toString(); } public Object stringToObject(String xml) throws Exception { return new Integer(xml); } public Object next(Object current, SessionImplementor session) { return new Integer( ( (Integer) current ).intValue() + 1 ); } public Object seed(SessionImplementor session) { return ZERO; } public Comparator getComparator() { return ComparableComparator.INSTANCE; } public Object fromStringValue(String xml) { return new Integer(xml)
public class ShortType extends PrimitiveType implements DiscriminatorType, VersionType { private static final Short ZERO = new Short( (short) 0 ); public Serializable getDefaultValue() { return ZERO; } public Object get(ResultSet rs, String name) throws SQLException { return new Short( rs.getShort(name) ); } public Class getPrimitiveClass() { return short.class; } public Class getReturnedClass() { return Short.class; } public void set(PreparedStatement st, Object value, int index) throws SQLException { st.setShort( index, ( (Short) value ).shortValue() ); } public int sqlType() { return Types.SMALLINT; } public String getName() { return "short"; } public String objectToSQLString(Object value, Dialect dialect) throws Exception { return value.toString(); } public Object stringToObject(String xml) throws Exception { return new Short(xml); } public Object next(Object current, SessionImplementor session) { return new Short( (short) ( ( (Short) current ).shortValue() + 1 ) ); } public Object seed(SessionImplementor session) { return ZERO; } public Comparator getComparator() { return ComparableComparator.INSTANCE; } public Object fromStringValue(String xml) { return new Short(xml)
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/IntegerType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/ShortType.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class IntegerType extends PrimitiveType implements DiscriminatorType, VersionType {
1
public class ShortType extends PrimitiveType  implements DiscriminatorType, VersionType {
2
	private static final Integer ZERO = new Integer(0);
2
	private static final Short ZERO = new Short( (short) 0 );
3
	public Serializable getDefaultValue() {
3
	public Serializable getDefaultValue() {
4
		return ZERO;
4
		return ZERO;
5
	}
5
	}
6
	
6
	
7
	public Object get(ResultSet rs, String name) throws SQLException {
7
	public Object get(ResultSet rs, String name) throws SQLException {
8
		return new Integer( rs.getInt(name) );
8
		return new Short( rs.getShort(name) );
9
	}
9
	}
10
	public Class getPrimitiveClass() {
10
	public Class getPrimitiveClass() {
11
		return int.class;
11
		return short.class;
12
	}
12
	}
13
	public Class getReturnedClass() {
13
	public Class getReturnedClass() {
14
		return Integer.class;
14
		return Short.class;
15
	}
15
	}
16
	public void set(PreparedStatement st, Object value, int index)
16
	public void set(PreparedStatement st, Object value, int index)
17
	throws SQLException {
17
 throws SQLException {
18
		st.setInt( index, ( (Integer) value ).intValue() );
18
		st.setShort( index, ( (Short) value ).shortValue() );
19
	}
19
	}
20
	public int sqlType() {
20
	public int sqlType() {
21
		return Types.INTEGER;
21
		return Types.SMALLINT;
22
	}
22
	}
23
	public String getName() { return "integer"; }
23
	public String getName() { return "short"; }
24
	public String objectToSQLString(Object value, Dialect dialect) throws Exception {
24
	public String objectToSQLString(Object value, Dialect dialect) throws Exception {
25
		return value.toString();
25
		return value.toString();
26
	}
26
	}
27
	public Object stringToObject(String xml) throws Exception {
27
	public Object stringToObject(String xml) throws Exception {
28
		return new Integer(xml);
28
		return new Short(xml);
29
	}
29
	}
30
	public Object next(Object current, SessionImplementor session) {
30
	public Object next(Object current, SessionImplementor session) {
31
		return new Integer( ( (Integer) current ).intValue() + 1 );
31
		return new Short( (short) ( ( (Short) current ).shortValue() + 1 ) );
32
	}
32
	}
33
	public Object seed(SessionImplementor session) {
33
	public Object seed(SessionImplementor session) {
34
		return ZERO;
34
		return ZERO;
35
	}
35
	}
36
	public Comparator getComparator() {
36
	public Comparator getComparator() {
37
		return ComparableComparator.INSTANCE;
37
		return ComparableComparator.INSTANCE;
38
	}
38
	}
39
	
39
	
40
	public Object fromStringValue(String xml) {
40
	public Object fromStringValue(String xml) {
41
		return new Integer(xml)
41
		return new Short(xml)
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