if (x==y) return true; if (x==null || y==null) return false; Calendar calendar1 = (Calendar) x; Calendar calendar2 = (Calendar) y; return calendar1.get(Calendar.MILLISECOND) == calendar2.get(Calendar.MILLISECOND) && calendar1.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND) && calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE) && calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY) && calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
if (x==y) return true; if (x==null || y==null) return false; Calendar calendar1 = (Calendar) x; Calendar calendar2 = (Calendar) y; return calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
Clone fragments detected by clone detection tool
File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CalendarType.java File path: /hibernate-distribution-3.3.2.GA/project/core/src/main/java/org/hibernate/type/CalendarDateType.java
Method name: boolean isEqual(Object, Object) Method name: boolean isEqual(Object, Object)
Number of AST nodes: 7 Number of AST nodes: 7
1
if (x==y) return true;
1
if (x==y) return true;
2
		if (x==null || y==null) return false;
2
		if (x==null || y==null) return false;
3
		Calendar calendar1 = (Calendar) x;
3
		Calendar calendar1 = (Calendar) x;
4
		Calendar calendar2 = (Calendar) y;
4
		Calendar calendar2 = (Calendar) y;
5
		return calendar1.get(Calendar.MILLISECOND) == calendar2.get(Calendar.MILLISECOND)
5
		return
6
			&& calendar1.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND)
7
			&& calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE)
8
			&& calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY)
9
			&& calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH)
6
 calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH)
10
			&& calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH)
7
			&& calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH)
11
			&& calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
8
			&& calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
Summary
Number of common nesting structure subtrees1
Number of refactorable cases0
Number of non-refactorable cases1
Time elapsed for finding largest common nesting structure subtrees (ms)0.3
Clones locationClones are in different classes having the same super class
Number of node comparisons22
  1. {Non-refactorable}
    Mapping Summary
    Number of mapped statements6
    Number of unmapped statements in the first code fragment1
    Number of unmapped statements in the second code fragment1
    Time elapsed for statement mapping (ms)1.5
    Clone typeType 2
    Mapped Statements
    ID Statement ID Statement
    1
    if (x == y)
    1
    if (x == y)
    2
    return true;
    2
    return true;
    3
    if (x == null || y == null)
    3
    if (x == null || y == null)
    4
    return false;
    4
    return false;
    5
    Calendar calendar1 = (Calendar)x;
    5
    Calendar calendar1 = (Calendar)x;
    6
    Calendar calendar2 = (Calendar)y;
    6
    Calendar calendar2 = (Calendar)y;
                                                                                                                                                                                                                                                                                                                                                                                                                                                      
    7
    return calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
    7
    return calendar1.get(Calendar.MILLISECOND) == calendar2.get(Calendar.MILLISECOND) && calendar1.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND) && calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE) && calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY) && calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH) && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH) && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR);
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              
    Precondition Violations (1)
    Row Violation
    1Clone fragment #1 returns variables calendar1, calendar2 , while Clone fragment #2 returns variables calendar1, calendar2