File path: /jfreechart-1.0.10/src/org/jfree/data/time/Hour.java | File path: /jfreechart-1.0.10/src/org/jfree/data/time/Minute.java | |||
Method name: int compareTo(Object)
|
Method name: int compareTo(Object)
|
|||
Number of AST nodes: 8 | Number of AST nodes: 8 | |||
1 | if (o1 instanceof Hour) {↵ | 1 | if (o1 instanceof Minute) {↵ | |
2 | Hour h = (Hour) o1;↵ | 2 | Minute m = (Minute) o1;↵ | |
3 | result = getDay().compareTo(h.getDay());↵ | 3 | result = getHour().compareTo(m.getHour());↵ | |
4 | if (result == 0) {↵ | 4 | if (result == 0) {↵ | |
5 | result = this.hour - h.getHour();↵ | 5 | result = this.minute - m.getMinute();↵ | |
6 | }↵ | 6 | }↵ | |
7 | }↵ | 7 | }↵ | |
8 | // CASE 2 : Comparing to another TimePeriod object↵ | 8 | // CASE 2 : Comparing to another TimePeriod object↵ | |
9 | // -----------------------------------------------↵ | 9 | // -----------------------------------------------↵ | |
10 | else if (o1 instanceof RegularTimePeriod) {↵ | 10 | else if (o1 instanceof RegularTimePeriod) {↵ | |
11 | // more difficult case - evaluate later...↵ | 11 | // more difficult case - evaluate later...↵ | |
12 | result = 0;↵ | 12 | result = 0;↵ | |
13 | }↵ | 13 | }↵ | |
14 | // CASE 3 : Comparing to a non-TimePeriod object↵ | 14 | // CASE 3 : Comparing to a non-TimePeriod object↵ | |
15 | // ---------------------------------------------↵ | 15 | // ---------------------------------------------↵ | |
16 | else {↵ | 16 | else {↵ | |
17 | // consider time periods to be ordered after general objects↵ | 17 | // consider time periods to be ordered after general objects↵ | |
18 | result = 1;↵ | 18 | result = 1;↵ | |
19 | } | 19 |
| |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.3 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 22 |
Number of mapped statements | 8 |
Number of unmapped statements in the first code fragment | 0 |
Number of unmapped statements in the second code fragment | 0 |
Time elapsed for statement mapping (ms) | 4.6 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2 | if (o1 instanceof Hour) |
| 2 | if (o1 instanceof Minute) | ||||||||||||||||||||||
3 | Hour h = (Hour)o1; |
| 3 | Minute m = (Minute)o1; | ||||||||||||||||||||||
4 | result = getDay().compareTo(h.getDay()); |
| 4 | result = getHour().compareTo(m.getHour()); | ||||||||||||||||||||||
5 | if (result == 0) | 5 | if (result == 0) | |||||||||||||||||||||||
6 | result = this.hour - h.getHour(); |
| 6 | result = this.minute - m.getMinute(); | ||||||||||||||||||||||
7 | else if (o1 instanceof RegularTimePeriod) | 7 | else if (o1 instanceof RegularTimePeriod) | |||||||||||||||||||||||
8 | result = 0; | 8 | result = 0; | |||||||||||||||||||||||
else | else | |||||||||||||||||||||||||
9 | result = 1; | 9 | result = 1; |
Row | Violation |
---|---|
1 | Expression (Hour)o1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
2 | Expression (Minute)o1 cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression h.getDay() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Expression m.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression h cannot be unified with expression m , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public org.jfree.data.time.Day getDay() , public org.jfree.data.time.Hour getHour() |
6 | Expression h.getHour() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
7 | Expression m.getMinute() cannot be parameterized, because it has dependencies to/from statements that will be extracted |
8 | Expression h cannot be unified with expression m , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) public int getHour() , public int getMinute() |