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/testsuite/src/test/java/org/hibernate/test/cut/MonetoryAmountUserType.java | |||
Method name: boolean isEqual(Object, Object)
|
Method name: boolean equals(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 | ↵ | |
4 | Calendar calendar2 = (Calendar↵ | 4 | MonetoryAmount mx = (MonetoryAmount) x;↵ | |
5 | ) y;↵ | 5 | MonetoryAmount my = (MonetoryAmount) y;↵ | |
6 | return calendar1.get(Calendar.MILLISECOND) == calendar2.get(Calendar.MILLISECOND)↵ | 6 | return ↵ | |
7 | && calendar1.get(Calendar.SECOND) == calendar2.get(Calendar.SECOND)↵ | |||
8 | && calendar1.get(Calendar.MINUTE) == calendar2.get(Calendar.MINUTE)↵ | |||
9 | && calendar1.get(Calendar.HOUR_OF_DAY) == calendar2.get(Calendar.HOUR_OF_DAY)↵ | |||
10 | && calendar1.get(Calendar.DAY_OF_MONTH) == calendar2.get(Calendar.DAY_OF_MONTH)↵ | |||
11 | && calendar1.get(Calendar.MONTH) == calendar2.get(Calendar.MONTH)↵ | |||
12 | && calendar1.get(Calendar.YEAR) == calendar2.get(Calendar.YEAR↵ | 7 | mx.getAmount().equals( my.getAmount() ) &&↵ | |
13 | ); | 8 | mx.getCurrency().equals( my.getCurrency() ); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 1 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes |
Number of node comparisons | 22 |
Number of mapped statements | 5 |
Number of unmapped statements in the first code fragment | 2 |
Number of unmapped statements in the second code fragment | 2 |
Time elapsed for statement mapping (ms) | 1.0 |
Clone type | Type 2 |
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 | MonetoryAmount mx = (MonetoryAmount)x; | |||||||||||||||
5 | Calendar calendar1 = (Calendar)x; | | |||||||||||||||
| 6 | MonetoryAmount my = (MonetoryAmount)y; | |||||||||||||||
6 | Calendar calendar2 = (Calendar)y; | | |||||||||||||||
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); |
| 7 | return mx.getAmount().equals(my.getAmount()) && mx.getCurrency().equals(my.getCurrency()); |
Row | Violation |
---|