@Override public int hashCode() { final int PRIME = 31; int result = 1; result = PRIME * result + ((time == null) ? 0 : time.hashCode()); result = PRIME * result + ((value == null) ? 0 : value.hashCode()); return result; }
/** * @param that The time with which to compare this * @return true if this < that. */ public boolean before(Time that) { if (!this.isHourUnspecified() && !that.isHourUnspecified()) { if (this.hour < that.hour) return true; if (this.hour > that.hour) return false; } if (!this.isMinuteUnspecified() && !that.isMinuteUnspecified()) { if (this.minute < that.minute) return true; if (this.minute > that.minute) return false; } if (!this.isSecondUnspecified() && !that.isSecondUnspecified()) { if (this.second < that.second) return true; if (this.second > that.second) return false; } if (this.isHundredthUnspecified() || that.isHundredthUnspecified()) return false; return this.hundredth < that.hundredth; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; final TimeValue other = (TimeValue) obj; if (time == null) { if (other.time != null) return false; } else if (!time.equals(other.time)) return false; if (value == null) { if (other.value != null) return false; } else if (!value.equals(other.value)) return false; return true; }