⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 simpletimezone.java

📁 java源代码 请看看啊 提点宝贵的意见
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * @return a clone of this instance.     */    public Object clone()    {        return super.clone();    }    /**     * Generates the hash code for the SimpleDateFormat object.     * @return the hash code for this object     */    public synchronized int hashCode()    {        return startMonth ^ startDay ^ startDayOfWeek ^ startTime ^            endMonth ^ endDay ^ endDayOfWeek ^ endTime ^ rawOffset;    }    /**     * Compares the equality of two <code>SimpleTimeZone</code> objects.     *     * @param obj  The <code>SimpleTimeZone</code> object to be compared with.     * @return     True if the given <code>obj</code> is the same as this     *		   <code>SimpleTimeZone</code> object; false otherwise.     */    public boolean equals(Object obj)    {        if (this == obj) {            return true;	}        if (!(obj instanceof SimpleTimeZone)) {            return false;	}        SimpleTimeZone that = (SimpleTimeZone) obj;        return getID().equals(that.getID()) &&            hasSameRules(that);    }    /**     * Returns true if this zone has the same rules and offset as another zone.     * @param other the TimeZone object to be compared with     * @return true if the given zone is a SimpleTimeZone and has the     * same rules and offset as this one     * @since 1.2     */    public boolean hasSameRules(TimeZone other) {        if (this == other) {	    return true;	}        if (!(other instanceof SimpleTimeZone)) {	    return false;	}        SimpleTimeZone that = (SimpleTimeZone) other;        return rawOffset == that.rawOffset &&            useDaylight == that.useDaylight &&            (!useDaylight             // Only check rules if using DST             || (dstSavings == that.dstSavings &&                 startMode == that.startMode &&                 startMonth == that.startMonth &&                 startDay == that.startDay &&                 startDayOfWeek == that.startDayOfWeek &&                 startTime == that.startTime &&                 startTimeMode == that.startTimeMode &&                 endMode == that.endMode &&                 endMonth == that.endMonth &&                 endDay == that.endDay &&                 endDayOfWeek == that.endDayOfWeek &&                 endTime == that.endTime &&                 endTimeMode == that.endTimeMode &&                 startYear == that.startYear));    }    /**     * Returns a string representation of this time zone.     * @return a string representation of this time zone.     */    public String toString() {        return getClass().getName() +            "[id=" + getID() +            ",offset=" + rawOffset +            ",dstSavings=" + dstSavings +            ",useDaylight=" + useDaylight +            ",startYear=" + startYear +            ",startMode=" + startMode +            ",startMonth=" + startMonth +            ",startDay=" + startDay +            ",startDayOfWeek=" + startDayOfWeek +            ",startTime=" + startTime +            ",startTimeMode=" + startTimeMode +            ",endMode=" + endMode +            ",endMonth=" + endMonth +            ",endDay=" + endDay +            ",endDayOfWeek=" + endDayOfWeek +            ",endTime=" + endTime +            ",endTimeMode=" + endTimeMode + ']';    }    // =======================privates===============================    /**     * The month in which daylight saving time starts.  This value must be     * between <code>Calendar.JANUARY</code> and     * <code>Calendar.DECEMBER</code> inclusive.  This value must not equal     * <code>endMonth</code>.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int startMonth;    /**     * This field has two possible interpretations:     * <dl>     * <dt><code>startMode == DOW_IN_MONTH</code></dt>     * <dd>     * <code>startDay</code> indicates the day of the month of     * <code>startMonth</code> on which daylight     * saving time starts, from 1 to 28, 30, or 31, depending on the     * <code>startMonth</code>.     * </dd>     * <dt><code>startMode != DOW_IN_MONTH</code></dt>     * <dd>     * <code>startDay</code> indicates which <code>startDayOfWeek</code> in th     * month <code>startMonth</code> daylight     * saving time starts on.  For example, a value of +1 and a     * <code>startDayOfWeek</code> of <code>Calendar.SUNDAY</code> indicates the     * first Sunday of <code>startMonth</code>.  Likewise, +2 would indicate the     * second Sunday, and -1 the last Sunday.  A value of 0 is illegal.     * </dd>     * </ul>     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int startDay;    /**     * The day of the week on which daylight saving time starts.  This value     * must be between <code>Calendar.SUNDAY</code> and     * <code>Calendar.SATURDAY</code> inclusive.     * <p>If <code>useDaylight</code> is false or     * <code>startMode == DAY_OF_MONTH</code>, this value is ignored.     * @serial     */    private int startDayOfWeek;    /**     * The time in milliseconds after midnight at which daylight saving     * time starts.  This value is expressed as wall time, standard time,     * or UTC time, depending on the setting of <code>startTimeMode</code>.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int startTime;    /**     * The format of startTime, either WALL_TIME, STANDARD_TIME, or UTC_TIME.     * @serial     * @since 1.3     */    private int startTimeMode;    /**     * The month in which daylight saving time ends.  This value must be     * between <code>Calendar.JANUARY</code> and     * <code>Calendar.UNDECIMBER</code>.  This value must not equal     * <code>startMonth</code>.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int endMonth;    /**     * This field has two possible interpretations:     * <dl>     * <dt><code>endMode == DOW_IN_MONTH</code></dt>     * <dd>     * <code>endDay</code> indicates the day of the month of     * <code>endMonth</code> on which daylight     * saving time ends, from 1 to 28, 30, or 31, depending on the     * <code>endMonth</code>.     * </dd>     * <dt><code>endMode != DOW_IN_MONTH</code></dt>     * <dd>     * <code>endDay</code> indicates which <code>endDayOfWeek</code> in th     * month <code>endMonth</code> daylight     * saving time ends on.  For example, a value of +1 and a     * <code>endDayOfWeek</code> of <code>Calendar.SUNDAY</code> indicates the     * first Sunday of <code>endMonth</code>.  Likewise, +2 would indicate the     * second Sunday, and -1 the last Sunday.  A value of 0 is illegal.     * </dd>     * </ul>     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int endDay;    /**     * The day of the week on which daylight saving time ends.  This value     * must be between <code>Calendar.SUNDAY</code> and     * <code>Calendar.SATURDAY</code> inclusive.     * <p>If <code>useDaylight</code> is false or     * <code>endMode == DAY_OF_MONTH</code>, this value is ignored.     * @serial     */    private int endDayOfWeek;    /**     * The time in milliseconds after midnight at which daylight saving     * time ends.  This value is expressed as wall time, standard time,     * or UTC time, depending on the setting of <code>endTimeMode</code>.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int endTime;    /**     * The format of endTime, either WALL_TIME, STANDARD_TIME, or UTC_TIME.     * @serial     * @since 1.3     */    private int endTimeMode;    /**     * The year in which daylight saving time is first observed.  This is an AD     * value.  If this value is less than 1 then daylight saving time is observed     * for all AD years.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     */    private int startYear;    /**     * The offset in milliseconds between this zone and GMT.  Negative offsets     * are to the west of Greenwich.  To obtain local <em>standard</em> time,     * add the offset to GMT time.  To obtain local wall time it may also be     * necessary to add <code>dstSavings</code>.     * @serial     */    private int rawOffset;    /**     * A boolean value which is true if and only if this zone uses daylight     * saving time.  If this value is false, several other fields are ignored.     * @serial     */    private boolean useDaylight=false; // indicate if this time zone uses DST    private static final int millisPerHour = 60*60*1000;    private static final int millisPerDay  = 24*millisPerHour;    /**     * This field was serialized in JDK 1.1, so we have to keep it that way     * to maintain serialization compatibility. However, there's no need to     * recreate the array each time we create a new time zone.     * @serial An array of bytes containing the values {31, 28, 31, 30, 31, 30,     * 31, 31, 30, 31, 30, 31}.  This is ignored as of the Java 2 platform v1.2, however, it must     * be streamed out for compatibility with JDK 1.1.     */    private final byte monthLength[] = staticMonthLength;    private final static byte staticMonthLength[] = {31,28,31,30,31,30,31,31,30,31,30,31};    private final static byte staticLeapMonthLength[] = {31,29,31,30,31,30,31,31,30,31,30,31};    /**     * Variables specifying the mode of the start rule.  Takes the following     * values:     * <dl>     * <dt><code>DOM_MODE</code></dt>     * <dd>     * Exact day of week; e.g., March 1.     * </dd>     * <dt><code>DOW_IN_MONTH_MODE</code></dt>         * <dd>     * Day of week in month; e.g., last Sunday in March.     * </dd>     * <dt><code>DOW_GE_DOM_MODE</code></dt>     * <dd>     * Day of week after day of month; e.g., Sunday on or after March 15.     * </dd>     * <dt><code>DOW_LE_DOM_MODE</code></dt>     * <dd>     * Day of week before day of month; e.g., Sunday on or before March 15.     * </dd>     * </dl>     * The setting of this field affects the interpretation of the     * <code>startDay</code> field.     * <p>If <code>useDaylight</code> is false, this value is ignored.     * @serial     * @since 1.1.4     */    private int startMode;    /**     * Variables specifying the mode of the end rule.  Takes the following     * values:     * <dl>     * <dt><code>DOM_MODE</code></dt>     * <dd>     * Exact day of week; e.g., March 1.     * </dd>     * <dt><code>DOW_IN_MONTH_MODE</code></dt>         * <dd>     * Day of week in month; e.g., last Sunday in March.     * </dd>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -