/** * Test if the other time zone uses the same rule and only possibly differs in ID. This * implementation for this particular class will return true if the other object is a * SimpleTimeZone, the raw offsets and useDaylight are identical and if useDaylight is true, also * the start and end datas are identical. * * @return true if this zone uses the same rule. */ public boolean hasSameRules(TimeZone other) { if (this == other) return true; if (!(other instanceof SimpleTimeZone)) return false; SimpleTimeZone zone = (SimpleTimeZone) other; if (zone.hashCode() != hashCode() || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight) return false; if (!useDaylight) return true; return (startYear == zone.startYear && startMonth == zone.startMonth && startDay == zone.startDay && startDayOfWeek == zone.startDayOfWeek && startTime == zone.startTime && endMonth == zone.endMonth && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek && endTime == zone.endTime); }
public synchronized boolean equals(Object o) { if (this == o) return true; if (!(o instanceof SimpleTimeZone)) return false; SimpleTimeZone zone = (SimpleTimeZone) o; if (zone.hashCode() != hashCode() || !getID().equals(zone.getID()) || rawOffset != zone.rawOffset || useDaylight != zone.useDaylight) return false; if (!useDaylight) return true; return (startYear == zone.startYear && startMonth == zone.startMonth && startDay == zone.startDay && startDayOfWeek == zone.startDayOfWeek && startTime == zone.startTime && endMonth == zone.endMonth && endDay == zone.endDay && endDayOfWeek == zone.endDayOfWeek && endTime == zone.endTime); }