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: 18 | Number of AST nodes: 18 | |||
1 | if (i != -1) {↵ | 1 | if (i != -1) {↵ | |
2 | String s1 = s.substring(0, i).trim();↵ | 2 | String s1 = s.substring(0, i).trim();↵ | |
3 | String s2 = s.substring(i + 1, s.length()).trim();↵ | 3 | String s2 = s.substring(i + 1, s.length()).trim();↵ | |
4 | Year year = Month.evaluateAsYear(s1);↵ | 4 | Year y = Week.evaluateAsYear(s1);↵ | |
5 | int month;↵ | 5 | int w;↵ | |
6 | if (year != null) {↵ | 6 | if (y != null) {↵ | |
7 | month = SerialDate.stringToMonthCode(s2);↵ | 7 | w = Week.stringToWeek(s2);↵ | |
8 | if (month == -1) {↵ | 8 | if (w == -1) {↵ | |
9 | throw new TimePeriodFormatException(↵ | 9 | throw new TimePeriodFormatException(↵ | |
10 | "Can't evaluate the month."↵ | 10 | "Can't evaluate the ↵ | |
11 | );↵ | 11 | week.");↵ | |
12 | }↵ | 12 | }↵ | |
13 | result = new Month(month, year);↵ | 13 | result = new Week(w, y);↵ | |
14 | }↵ | 14 | }↵ | |
15 | else {↵ | 15 | else {↵ | |
16 | year = Month.evaluateAsYear(s2);↵ | 16 | y = Week.evaluateAsYear(s2);↵ | |
17 | if (year != null) {↵ | 17 | if (y != null) {↵ | |
18 | month = SerialDate.stringToMonthCode(s1);↵ | 18 | w = Week.stringToWeek(s1);↵ | |
19 | if (month == -1) {↵ | 19 | if (w == -1) {↵ | |
20 | throw new TimePeriodFormatException(↵ | 20 | throw new TimePeriodFormatException(↵ | |
21 | "Can't evaluate the month."↵ | 21 | "Can't evaluate the ↵ | |
22 | );↵ | 22 | week.");↵ | |
23 | }↵ | 23 | }↵ | |
24 | result = new Month(month, year);↵ | 24 | result = new Week(w, y);↵ | |
25 | }↵ | 25 | }↵ | |
26 | else {↵ | 26 | else {↵ | |
27 | throw new TimePeriodFormatException(↵ | 27 | throw new TimePeriodFormatException(↵ | |
28 | "Can't evaluate the year."↵ | 28 | "Can't evaluate the year."↵ | |
29 | );↵ | 29 | );↵ | |
30 | }↵ | 30 | }↵ | |
31 | }↵ | 31 | }↵ | |
32 | }↵ | 32 | }↵ | |
33 | else {↵ | 33 | else {↵ | |
34 | throw new TimePeriodFormatException(↵ | 34 | throw new TimePeriodFormatException(↵ | |
35 | "Could not find separator."↵ | 35 | "Could not find separator."↵ | |
36 | );↵ | 36 | );↵ | |
37 | } | 37 |
| |
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.8 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 80 |
Number of mapped statements | 16 |
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) | 5.2 |
Clone type | Type 2 |
ID | Statement | ID | Statement | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
5 | if (i != -1) | 5 | if (i != -1) | ||||||||||||||||||||||
6 | String s1 = s.substring(0, i).trim(); | 6 | String s1 = s.substring(0, i).trim(); | ||||||||||||||||||||||
7 | String s2 = s.substring(i + 1, s.length()).trim(); | 7 | String s2 = s.substring(i + 1, s.length()).trim(); | ||||||||||||||||||||||
8 | Year year = Month.evaluateAsYear(s1); |
| 8 | Year y = Week.evaluateAsYear(s1); | |||||||||||||||||||||
9 | int month; |
| 9 | int w; | |||||||||||||||||||||
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."); | ||||||||||||||||||||||
else | else | ||||||||||||||||||||||||
22 | throw new TimePeriodFormatException("Could not find separator."); | 22 | throw new TimePeriodFormatException("Could not find separator."); |
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 | Unmatched statement w=Week.stringToWeek(s2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
3 | Unmatched statement month=SerialDate.stringToMonthCode(s2); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
4 | Expression new Month(month,year) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
5 | Expression new Week(w,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
6 | 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) |
7 | Unmatched statement w=Week.stringToWeek(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
8 | Unmatched statement month=SerialDate.stringToMonthCode(s1); cannot be moved before or after the extracted code, because it has dependencies to/from statements that will be extracted |
9 | Expression new Month(month,year) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
10 | Expression new Week(w,y) cannot be parameterized, because it has dependencies to/from statements that will be extracted |
11 | Clone fragment #1 returns variables s2, month, s1, result , while Clone fragment #2 returns variables s2, w, s1, result |