File path: /jfreechart-1.0.10/src/org/jfree/data/time/Month.java | File path: /jfreechart-1.0.10/src/org/jfree/data/time/Week.java | |||
Method name: Month parseMonth(String)
|
Method name: Week parseWeek(String)
|
|||
Number of AST nodes: 12 | Number of AST nodes: 12 | |||
1 | if (year != null) {↵ | 1 | if (y != null) {↵ | |
2 | month = SerialDate.stringToMonthCode(s2);↵ | 2 | w = Week.stringToWeek(s2);↵ | |
3 | if (month == -1) {↵ | 3 | if (w == -1) {↵ | |
4 | throw new TimePeriodFormatException(↵ | 4 | throw new TimePeriodFormatException(↵ | |
5 | "Can't evaluate the month."↵ | 5 | "Can't evaluate the ↵ | |
6 | );↵ | 6 | week.");↵ | |
7 | }↵ | 7 | }↵ | |
8 | result = new Month(month, year);↵ | 8 | result = new Week(w, y);↵ | |
9 | }↵ | 9 | }↵ | |
10 | else {↵ | 10 | else {↵ | |
11 | year = Month.evaluateAsYear(s2);↵ | 11 | y = Week.evaluateAsYear(s2);↵ | |
12 | if (year != null) {↵ | 12 | if (y != null) {↵ | |
13 | month = SerialDate.stringToMonthCode(s1);↵ | 13 | w = Week.stringToWeek(s1);↵ | |
14 | if (month == -1) {↵ | 14 | if (w == -1) {↵ | |
15 | throw new TimePeriodFormatException(↵ | 15 | throw new TimePeriodFormatException(↵ | |
16 | "Can't evaluate the month."↵ | 16 | "Can't evaluate the ↵ | |
17 | );↵ | 17 | week.");↵ | |
18 | }↵ | 18 | }↵ | |
19 | result = new Month(month, year);↵ | 19 | result = new Week(w, y);↵ | |
20 | }↵ | 20 | }↵ | |
21 | else {↵ | 21 | else {↵ | |
22 | throw new TimePeriodFormatException(↵ | 22 | throw new TimePeriodFormatException(↵ | |
23 | "Can't evaluate the year."↵ | 23 | "Can't evaluate the year."↵ | |
24 | );↵ | 24 | );↵ | |
25 | }↵ | 25 | }↵ | |
26 | } | 26 |
| |
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.6 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 44 |
Number of mapped statements | 10 |
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) | 3.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | if (year != null) |
| 10 | if (y != null) | |||||||||||||||||||||
| 11 | w = Week.stringToWeek(s2); | |||||||||||||||||||||||
11 | month = SerialDate.stringToMonthCode(s2); | | |||||||||||||||||||||||
12 | if (month == -1) |
| 12 | if (w == -1) | |||||||||||||||||||||
13 | throw new TimePeriodFormatException("Can't evaluate the month."); |
| 13 | throw new TimePeriodFormatException("Can't evaluate the week."); | |||||||||||||||||||||
14 | result = new Month(month, year); |
| 14 | result = new Week(w, y); | |||||||||||||||||||||
else | else | ||||||||||||||||||||||||
15 | year = Month.evaluateAsYear(s2); |
| 15 | y = Week.evaluateAsYear(s2); | |||||||||||||||||||||
16 | if (year != null) |
| 16 | if (y != null) | |||||||||||||||||||||
| 17 | w = Week.stringToWeek(s1); | |||||||||||||||||||||||
17 | month = SerialDate.stringToMonthCode(s1); | | |||||||||||||||||||||||
18 | if (month == -1) |
| 18 | if (w == -1) | |||||||||||||||||||||
19 | throw new TimePeriodFormatException("Can't evaluate the month."); |
| 19 | throw new TimePeriodFormatException("Can't evaluate the week."); | |||||||||||||||||||||
20 | result = new Month(month, year); |
| 20 | result = new Week(w, y); | |||||||||||||||||||||
else | else | ||||||||||||||||||||||||
21 | throw new TimePeriodFormatException("Can't evaluate the year."); | 21 | throw new TimePeriodFormatException("Can't evaluate the year."); |
Row | Violation |
---|---|
1 | Expression Month cannot be unified with expression Week , because common superclass org.jfree.data.time.RegularTimePeriod does not declare member(s) private static org.jfree.data.time.Year evaluateAsYear(java.lang.String) |
2 | Expression new Month(month,year) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
3 | Expression new Week(w,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
4 | Clone fragment #1 returns variable result with type org.jfree.data.time.Month , while Clone fragment #2 returns variable result with type org.jfree.data.time.Week |