if (this.week != FIRST_WEEK_IN_YEAR) {
result = new Week(this.week - 1, this.year);
}
else {
// we need to work out if the previous year has 52 or 53 weeks...
if (this.year > 1900) {
int yy = this.year - 1;
Calendar prevYearCalendar = Calendar.getInstance();
prevYearCalendar.set(yy, Calendar.DECEMBER, 31);
result = new Week(prevYearCalendar.getActualMaximum(
Calendar.WEEK_OF_YEAR), yy);
}
else {
result = null;
}
}
Calendar calendar = Calendar.getInstance();
calendar.set(this.year, Calendar.DECEMBER, 31);
int actualMaxWeek
= calendar.getActualMaximum(Calendar.WEEK_OF_YEAR);
if (this.week < actualMaxWeek) {
result = new Week(this.week + 1, this.year);
}
else {
if (this.year < 9999) {
result = new Week(FIRST_WEEK_IN_YEAR, this.year + 1);
}
else {
result = null;
}
}
Clone fragments detected by clone detection tool
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Week.java
|
|
File path: /jfreechart-1.0.10/src/org/jfree/data/time/Week.java
|
Method name: RegularTimePeriod previous()
|
|
Method name: RegularTimePeriod next()
|
Number of AST nodes: 8
|
|
Number of AST nodes: 8
|
|
1 | if (this.week != FIRST_WEEK_IN_YEAR) {↵ | | |
|
2 | result = new Week(this.week - 1, this.year↵ | | 1 | Calendar calendar = Calendar.getInstance();↵
|
3 | );↵ | | 2 | calendar.set(this.year, Calendar.DECEMBER, 31);↵
|
4 | }↵ | | 3 | ↵
|
5 | else {↵ | | |
|
6 | // we need to work out if the previous year has 52 or 53 weeks...↵ | | 4 | int actualMaxWeek ↵
|
| | | 5 | = calendar.getActualMaximum(Calendar.WEEK_OF_YEAR);↵
|
7 | if (this.year > 1900) {↵ | | 6 | if (this.week < actualMaxWeek) {↵
|
8 | int yy = this.year - 1;↵ | | 7 | result = new Week(this.week + 1, this.year);↵
|
9 | ↵ | | 8 | }↵
|
10 | Calendar prevYearCalendar = Calendar.getInstance();↵ | | 9 | ↵
|
11 | prevYearCalendar.set(yy, Calendar.DECEMBER, 31);↵ | | |
|
12 | result = new Week(prevYearCalendar.getActualMaximum(↵ | | |
|
13 | Calendar.↵ | | 10 | else {↵
|
| | | 11 | if (this.year < 9999) {↵
|
14 | WEEK_OF_YEAR), yy);↵ | | 12 | result = new Week(FIRST_WEEK_IN_YEAR, ↵
|
| | | 13 | this.year + 1);↵
|
15 | }↵ | | 14 | }↵
|
16 | else {↵ | | 15 | else {↵
|
17 | result = null;↵ | | 16 | result = null;↵
|
18 | }↵ | | 17 | ↵
|
| | | 18 | }↵
|
19 | } | | 19 | }
|
See real code fragment |
|
See real code fragment |
Summary
Number of common nesting structure subtrees | 0 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 0 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.2 |
Clones location | Clones are declared in the same class |
Number of node comparisons | 1 |