Methods Summary |
---|
public boolean | equals(java.lang.Object obj)
if (!(obj instanceof Day)) return false;
Day other = (Day) obj;
if (obj == null) return false;
if (this == obj) return true;
boolean equals = (this.day == other.day);
if (timezone != null) {
equals = equals && timezone.equals(other.timezone);
}
return equals;
|
public int | getDay()
return day;
|
public java.lang.String | getTimezone()
return timezone;
|
public int | hashCode()Return the value of day XORed with the hashCode of timezone
iff one is defined.
return null == timezone ? day : day ^ timezone.hashCode();
|
public void | setDay(int day)Set the day
// validate day
if (day < 1 || day > 31) {
throw new NumberFormatException(
Messages.getMessage("badDay00"));
}
this.day = day;
|
public void | setTimezone(java.lang.String timezone)
// validate timezone
if (timezone != null && timezone.length() > 0) {
// Format [+/-]HH:MM
if (timezone.charAt(0)=='+" || (timezone.charAt(0)=='-")) {
if (timezone.length() != 6 ||
!Character.isDigit(timezone.charAt(1)) ||
!Character.isDigit(timezone.charAt(2)) ||
timezone.charAt(3) != ':" ||
!Character.isDigit(timezone.charAt(4)) ||
!Character.isDigit(timezone.charAt(5)))
throw new NumberFormatException(
Messages.getMessage("badTimezone00"));
} else if (!timezone.equals("Z")) {
throw new NumberFormatException(
Messages.getMessage("badTimezone00"));
}
// if we got this far, its good
this.timezone = timezone;
}
|
public void | setValue(int day, java.lang.String timezone)
setDay(day);
setTimezone(timezone);
|
public void | setValue(int day)
setDay(day);
|
public java.lang.String | toString()
// use NumberFormat to ensure leading zeros
NumberFormat nf = NumberFormat.getInstance();
nf.setGroupingUsed(false);
// Day
nf.setMinimumIntegerDigits(2);
String s = "---" + nf.format(day);
// timezone
if (timezone != null) {
s = s + timezone;
}
return s;
|