public class ByteType extends PrimitiveType implements DiscriminatorType, VersionType { private static final Byte ZERO = new Byte( (byte) 0 ); public Serializable getDefaultValue() { return ZERO; } public Object get(ResultSet rs, String name) throws SQLException { return new Byte( rs.getByte(name) ); } public Class getPrimitiveClass() { return byte.class; } public Class getReturnedClass() { return Byte.class; } public void set(PreparedStatement st, Object value, int index) throws SQLException { st.setByte( index, ( (Byte) value ).byteValue() ); } public int sqlType() { return Types.TINYINT; } public String getName() { return "byte"; } public String objectToSQLString(Object value, Dialect dialect) throws Exception { return value.toString(); } public Object stringToObject(String xml) throws Exception { return new Byte(xml); } public Object fromStringValue(String xml) { return new Byte(xml); } public Object next(Object current, SessionImplementor session) { return new Byte( (byte) ( ( (Byte) current ).byteValue() + 1 ) ); } public Object seed(SessionImplementor session) { return ZERO; } public Comparator getComparator() { return ComparableComparator.INSTANCE;
public class LongType extends PrimitiveType implements DiscriminatorType, VersionType { private static final Long ZERO = new Long(0); public Serializable getDefaultValue() { return ZERO; } public Object get(ResultSet rs, String name) throws SQLException { return new Long( rs.getLong(name) ); } public Class getPrimitiveClass() { return long.class; } public Class getReturnedClass() { return Long.class; } public void set(PreparedStatement st, Object value, int index) throws SQLException { st.setLong( index, ( (Long) value ).longValue() ); } public int sqlType() { return Types.BIGINT; } public String getName() { return "long"; } public Object stringToObject(String xml) throws Exception { return new Long(xml); } public Object next(Object current, SessionImplementor session) { return new Long( ( (Long) current ).longValue() + 1 ); } public Object seed(SessionImplementor session) { return ZERO; } public Comparator getComparator() { return ComparableComparator.INSTANCE; } public String objectToSQLString(Object value, Dialect dialect) throws Exception { return value.toString(); } public Object fromStringValue(String xml) { return new Long(xml);
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/ByteType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/LongType.java
Method name: Method name:
Number of AST nodes: 0 Number of AST nodes: 0
1
public class ByteType extends PrimitiveType implements DiscriminatorType, VersionType {
1
public class LongType extends PrimitiveType implements DiscriminatorType, VersionType {
2
	private static final Byte ZERO = new Byte( (byte) 0 );
2
	private static final Long ZERO = new Long(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 Byte( rs.getByte(name) );
8
		return new Long( rs.getLong(name) );
9
	}
9
	}
10
	public Class getPrimitiveClass() {
10
	public Class getPrimitiveClass() {
11
		return byte.class;
11
		return long.class;
12
	}
12
	}
13
	public Class getReturnedClass() {
13
	public Class getReturnedClass() {
14
		return Byte.class;
14
		return Long.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.setByte( index, ( (Byte) value ).byteValue() );
18
		st.setLong( index, ( (Long) value ).longValue() );
19
	}
19
	}
20
	public int sqlType() {
20
	public int sqlType() {
21
		return Types.TINYINT;
21
		return Types.BIGINT;
22
	}
22
	}
23
	public String getName() { return "byte"; }
23
	public String getName() { return "
24
	public String objectToSQLString(Object value, Dialect dialect) throws Exception {
25
		return value.toString();
26
	}
27
	public Object stringToObject(String xml) throws Exception {
28
		return new Byte(xml);
29
	}
30
	public Object fromStringValue(String xml) {
31
		return new Byte
24
long"; }
25
	public Object stringToObject(String xml) throws Exception {
32
(xml);
26
		return new Long(xml);
33
	}
27
	}
34
	public Object next(Object current, SessionImplementor session) {
28
	public Object next(Object current, SessionImplementor session) {
35
		return new Byte( (byte) ( ( (Byte) current ).byteValue() + 1 ) );
29
		return new Long( ( (Long) current ).longValue() + 1 );
36
	}
30
	}
37
	public Object seed(SessionImplementor session) {
31
	public Object seed(SessionImplementor session) {
38
		return ZERO;
32
		return ZERO;
39
	}
33
	}
40
	public Comparator getComparator() {
34
	public Comparator getComparator() {
41
		return ComparableComparator.INSTANCE;
35
		return ComparableComparator.INSTANCE;
42
	
36
	}
37
	
38
	public String objectToSQLString(Object value, Dialect dialect) throws Exception {
39
		return value.toString();
40
	}
41
	public Object fromStringValue(String xml) {
42
		return new Long(xml);
43
	
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