Methods Summary |
---|
public int | compareTo(java.lang.Object obj)Compare this MonthYear object to another.
MonthYear rhs = (MonthYear) obj;
// first compare year
if (this.year < rhs.year) {
return -1;
} else if (this.year > rhs.year) {
return 1;
}
// then month
if (this.month < rhs.month) {
return -1;
} else if (this.month > rhs.month) {
return 1;
}
return 0;
|
public boolean | containsInMonth(DayMonthYear date)
return date.getMonth() == this.month
&& date.getYear() == this.year;
|
public boolean | equals(java.lang.Object obj)
if (obj instanceof MonthYear) {
MonthYear rhs = (MonthYear) obj;
return this.month == rhs.month
&& this.year == rhs.year;
}
return false;
|
public int | getMonth()
return this.month;
|
public int | getYear()
return this.year;
|
public int | hashCode()
return this.month ^ this.year;
|