• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * This code is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License version 2 only, as
7  * published by the Free Software Foundation.  Oracle designates this
8  * particular file as subject to the "Classpath" exception as provided
9  * by Oracle in the LICENSE file that accompanied this code.
10  *
11  * This code is distributed in the hope that it will be useful, but WITHOUT
12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14  * version 2 for more details (a copy is included in the LICENSE file that
15  * accompanied this code).
16  *
17  * You should have received a copy of the GNU General Public License version
18  * 2 along with this work; if not, write to the Free Software Foundation,
19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22  * or visit www.oracle.com if you need additional information or have any
23  * questions.
24  */
25 
26 package sun.util.calendar;
27 
28 import java.util.Locale;
29 import java.util.TimeZone;
30 
31 class ImmutableGregorianDate extends BaseCalendar.Date {
32     private final BaseCalendar.Date date;
33 
ImmutableGregorianDate(BaseCalendar.Date date)34     ImmutableGregorianDate(BaseCalendar.Date date) {
35         if (date == null) {
36             throw new NullPointerException();
37         }
38         this.date = date;
39     }
40 
getEra()41     public Era getEra() {
42         return date.getEra();
43     }
44 
setEra(Era era)45     public CalendarDate setEra(Era era) {
46         unsupported(); return this;
47     }
48 
getYear()49     public int getYear() {
50         return date.getYear();
51     }
52 
setYear(int year)53     public CalendarDate setYear(int year) {
54         unsupported(); return this;
55     }
56 
addYear(int n)57     public CalendarDate addYear(int n) {
58         unsupported(); return this;
59     }
60 
isLeapYear()61     public boolean isLeapYear() {
62         return date.isLeapYear();
63     }
64 
setLeapYear(boolean leapYear)65     void setLeapYear(boolean leapYear) {
66         unsupported();
67     }
68 
getMonth()69     public int getMonth() {
70         return date.getMonth();
71     }
72 
setMonth(int month)73     public CalendarDate setMonth(int month) {
74         unsupported(); return this;
75     }
76 
addMonth(int n)77     public CalendarDate addMonth(int n) {
78         unsupported(); return this;
79     }
80 
getDayOfMonth()81     public int getDayOfMonth() {
82         return date.getDayOfMonth();
83     }
84 
setDayOfMonth(int date)85     public CalendarDate setDayOfMonth(int date) {
86         unsupported(); return this;
87     }
88 
addDayOfMonth(int n)89     public CalendarDate addDayOfMonth(int n) {
90         unsupported(); return this;
91     }
92 
getDayOfWeek()93     public int getDayOfWeek() {
94         return date.getDayOfWeek();
95     }
96 
getHours()97     public int getHours() {
98         return date.getHours();
99     }
100 
setHours(int hours)101     public CalendarDate setHours(int hours) {
102         unsupported(); return this;
103     }
104 
addHours(int n)105     public CalendarDate addHours(int n) {
106         unsupported(); return this;
107     }
108 
getMinutes()109     public int getMinutes() {
110         return date.getMinutes();
111     }
112 
setMinutes(int minutes)113     public CalendarDate setMinutes(int minutes) {
114         unsupported(); return this;
115     }
116 
addMinutes(int n)117     public CalendarDate addMinutes(int n) {
118         unsupported(); return this;
119     }
120 
getSeconds()121     public int getSeconds() {
122         return date.getSeconds();
123     }
124 
setSeconds(int seconds)125     public CalendarDate setSeconds(int seconds) {
126         unsupported(); return this;
127     }
128 
addSeconds(int n)129     public CalendarDate addSeconds(int n) {
130         unsupported(); return this;
131     }
132 
getMillis()133     public int getMillis() {
134         return date.getMillis();
135     }
136 
setMillis(int millis)137     public CalendarDate setMillis(int millis) {
138         unsupported(); return this;
139     }
140 
addMillis(int n)141     public CalendarDate addMillis(int n) {
142         unsupported(); return this;
143     }
144 
getTimeOfDay()145     public long getTimeOfDay() {
146         return date.getTimeOfDay();
147     }
148 
setDate(int year, int month, int dayOfMonth)149     public CalendarDate setDate(int year, int month, int dayOfMonth) {
150         unsupported(); return this;
151     }
152 
addDate(int year, int month, int dayOfMonth)153     public CalendarDate addDate(int year, int month, int dayOfMonth) {
154         unsupported(); return this;
155     }
156 
setTimeOfDay(int hours, int minutes, int seconds, int millis)157     public CalendarDate setTimeOfDay(int hours, int minutes, int seconds, int millis) {
158         unsupported(); return this;
159     }
160 
addTimeOfDay(int hours, int minutes, int seconds, int millis)161     public CalendarDate addTimeOfDay(int hours, int minutes, int seconds, int millis) {
162         unsupported(); return this;
163     }
164 
setTimeOfDay(long fraction)165     protected void setTimeOfDay(long fraction) {
166         unsupported();
167     }
168 
isNormalized()169     public boolean isNormalized() {
170         return date.isNormalized();
171     }
172 
isStandardTime()173     public boolean isStandardTime() {
174         return date.isStandardTime();
175     }
176 
setStandardTime(boolean standardTime)177     public void setStandardTime(boolean standardTime) {
178         unsupported();
179     }
180 
isDaylightTime()181     public boolean isDaylightTime() {
182         return date.isDaylightTime();
183     }
184 
setLocale(Locale loc)185     protected void setLocale(Locale loc) {
186         unsupported();
187     }
188 
getZone()189     public TimeZone getZone() {
190         return date.getZone();
191     }
192 
setZone(TimeZone zoneinfo)193     public CalendarDate setZone(TimeZone zoneinfo) {
194         unsupported(); return this;
195     }
196 
isSameDate(CalendarDate date)197     public boolean isSameDate(CalendarDate date) {
198         return date.isSameDate(date);
199     }
200 
equals(Object obj)201     public boolean equals(Object obj) {
202         if (this == obj) {
203             return true;
204         }
205         if (!(obj instanceof ImmutableGregorianDate)) {
206             return false;
207         }
208         return date.equals(((ImmutableGregorianDate) obj).date);
209     }
210 
hashCode()211     public int hashCode() {
212         return date.hashCode();
213     }
214 
clone()215     public Object clone() {
216         return super.clone();
217     }
218 
toString()219     public String toString() {
220         return date.toString();
221     }
222 
setDayOfWeek(int dayOfWeek)223     protected void setDayOfWeek(int dayOfWeek) {
224         unsupported();
225     }
226 
setNormalized(boolean normalized)227     protected void setNormalized(boolean normalized) {
228         unsupported();
229     }
230 
getZoneOffset()231     public int getZoneOffset() {
232         return date.getZoneOffset();
233     }
234 
setZoneOffset(int offset)235     protected void setZoneOffset(int offset) {
236         unsupported();
237     }
238 
getDaylightSaving()239     public int getDaylightSaving() {
240         return date.getDaylightSaving();
241     }
242 
setDaylightSaving(int daylightSaving)243     protected void setDaylightSaving(int daylightSaving) {
244         unsupported();
245     }
246 
getNormalizedYear()247     public int getNormalizedYear() {
248         return date.getNormalizedYear();
249     }
250 
setNormalizedYear(int normalizedYear)251     public void setNormalizedYear(int normalizedYear) {
252         unsupported();
253     }
254 
unsupported()255     private void unsupported() {
256         throw new UnsupportedOperationException();
257     }
258 }
259