1// © 2016 and later: Unicode, Inc. and others.
2// License & terms of use: http://www.unicode.org/copyright.html#License
3/*
4 *******************************************************************************
5 * Copyright (C) 2007-2008, International Business Machines Corporation and    *
6 * others. All Rights Reserved.                                                *
7 *******************************************************************************
8 */
9package com.ibm.icu.util;
10
11import java.util.Date;
12
13/**
14 * <code>InitialTimeZoneRule</code> represents a time zone rule
15 * representing a time zone effective from the beginning and
16 * has no actual start times.
17 *
18 * @stable ICU 3.8
19 */
20public class InitialTimeZoneRule extends TimeZoneRule {
21
22    private static final long serialVersionUID = 1876594993064051206L;
23
24    /**
25     * Constructs a <code>InitialTimeZoneRule</code> with the name, the GMT offset of its
26     * standard time and the amount of daylight saving offset adjustment.
27     *
28     * @param name          The time zone name.
29     * @param rawOffset     The UTC offset of its standard time in milliseconds.
30     * @param dstSavings    The amount of daylight saving offset adjustment in milliseconds.
31     *                      If this ia a rule for standard time, the value of this argument is 0.
32     *
33     * @stable ICU 3.8
34     */
35    public InitialTimeZoneRule(String name, int rawOffset, int dstSavings) {
36        super(name, rawOffset, dstSavings);
37    }
38
39    /**
40     * {@inheritDoc}
41     *
42     * @stable ICU 3.8
43     */
44    @Override
45    public boolean isEquivalentTo(TimeZoneRule other) {
46        if (other instanceof InitialTimeZoneRule) {
47            return super.isEquivalentTo(other);
48        }
49        return false;
50    }
51
52    /**
53     * {@inheritDoc}<br><br>
54     * Note: This method in <code>InitialTimeZoneRule</code> always returns null.
55     *
56     * @stable ICU 3.8
57     */
58    @Override
59    public Date getFinalStart(int prevRawOffset, int prevDSTSavings) {
60        // No start time available
61        return null;
62    }
63
64    /**
65     * {@inheritDoc}<br><br>
66     * Note: This method in <code>InitialTimeZoneRule</code> always returns null.
67     *
68     * @stable ICU 3.8
69     */
70    @Override
71    public Date getFirstStart(int prevRawOffset, int prevDSTSavings) {
72        // No start time available
73        return null;
74    }
75
76    /**
77     * {@inheritDoc}<br><br>
78     * Note: This method in <code>InitialTimeZoneRule</code> always returns null.
79     *
80     * @stable ICU 3.8
81     */
82    @Override
83    public Date getNextStart(long base, int prevRawOffset, int prevDSTSavings,
84            boolean inclusive) {
85        // No start time available
86        return null;
87    }
88
89    /**
90     * {@inheritDoc}<br><br>
91     * Note: This method in <code>InitialTimeZoneRule</code> always returns null.
92     *
93     * @stable ICU 3.8
94     */
95    @Override
96    public Date getPreviousStart(long base, int prevRawOffset,
97            int prevDSTSavings, boolean inclusive) {
98        // No start time available
99        return null;
100    }
101
102    /**
103     * {@inheritDoc}<br><br>
104     * Note: This method in <code>InitialTimeZoneRule</code> always returns false.
105     * @stable ICU 3.8
106     */
107    @Override
108    public boolean isTransitionRule() {
109        return false;
110    }
111}
112