Path: blob/master/src/java.base/share/classes/sun/util/calendar/ImmutableGregorianDate.java
41159 views
/*1* Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.util.calendar;2627import java.util.Locale;28import java.util.TimeZone;2930class ImmutableGregorianDate extends BaseCalendar.Date {31private final BaseCalendar.Date date;3233ImmutableGregorianDate(BaseCalendar.Date date) {34if (date == null) {35throw new NullPointerException();36}37this.date = date;38}3940public Era getEra() {41return date.getEra();42}4344public CalendarDate setEra(Era era) {45unsupported(); return this;46}4748public int getYear() {49return date.getYear();50}5152public CalendarDate setYear(int year) {53unsupported(); return this;54}5556public CalendarDate addYear(int n) {57unsupported(); return this;58}5960public boolean isLeapYear() {61return date.isLeapYear();62}6364void setLeapYear(boolean leapYear) {65unsupported();66}6768public int getMonth() {69return date.getMonth();70}7172public CalendarDate setMonth(int month) {73unsupported(); return this;74}7576public CalendarDate addMonth(int n) {77unsupported(); return this;78}7980public int getDayOfMonth() {81return date.getDayOfMonth();82}8384public CalendarDate setDayOfMonth(int date) {85unsupported(); return this;86}8788public CalendarDate addDayOfMonth(int n) {89unsupported(); return this;90}9192public int getDayOfWeek() {93return date.getDayOfWeek();94}9596public int getHours() {97return date.getHours();98}99100public CalendarDate setHours(int hours) {101unsupported(); return this;102}103104public CalendarDate addHours(int n) {105unsupported(); return this;106}107108public int getMinutes() {109return date.getMinutes();110}111112public CalendarDate setMinutes(int minutes) {113unsupported(); return this;114}115116public CalendarDate addMinutes(int n) {117unsupported(); return this;118}119120public int getSeconds() {121return date.getSeconds();122}123124public CalendarDate setSeconds(int seconds) {125unsupported(); return this;126}127128public CalendarDate addSeconds(int n) {129unsupported(); return this;130}131132public int getMillis() {133return date.getMillis();134}135136public CalendarDate setMillis(int millis) {137unsupported(); return this;138}139140public CalendarDate addMillis(int n) {141unsupported(); return this;142}143144public long getTimeOfDay() {145return date.getTimeOfDay();146}147148public CalendarDate setDate(int year, int month, int dayOfMonth) {149unsupported(); return this;150}151152public CalendarDate addDate(int year, int month, int dayOfMonth) {153unsupported(); return this;154}155156public CalendarDate setTimeOfDay(int hours, int minutes, int seconds, int millis) {157unsupported(); return this;158}159160public CalendarDate addTimeOfDay(int hours, int minutes, int seconds, int millis) {161unsupported(); return this;162}163164protected void setTimeOfDay(long fraction) {165unsupported();166}167168public boolean isNormalized() {169return date.isNormalized();170}171172public boolean isStandardTime() {173return date.isStandardTime();174}175176public void setStandardTime(boolean standardTime) {177unsupported();178}179180public boolean isDaylightTime() {181return date.isDaylightTime();182}183184protected void setLocale(Locale loc) {185unsupported();186}187188public TimeZone getZone() {189return date.getZone();190}191192public CalendarDate setZone(TimeZone zoneinfo) {193unsupported(); return this;194}195196public boolean isSameDate(CalendarDate date) {197return date.isSameDate(date);198}199200public boolean equals(Object obj) {201if (this == obj) {202return true;203}204if (!(obj instanceof ImmutableGregorianDate)) {205return false;206}207return date.equals(((ImmutableGregorianDate) obj).date);208}209210public int hashCode() {211return date.hashCode();212}213214public Object clone() {215return super.clone();216}217218public String toString() {219return date.toString();220}221222protected void setDayOfWeek(int dayOfWeek) {223unsupported();224}225226protected void setNormalized(boolean normalized) {227unsupported();228}229230public int getZoneOffset() {231return date.getZoneOffset();232}233234protected void setZoneOffset(int offset) {235unsupported();236}237238public int getDaylightSaving() {239return date.getDaylightSaving();240}241242protected void setDaylightSaving(int daylightSaving) {243unsupported();244}245246public int getNormalizedYear() {247return date.getNormalizedYear();248}249250public void setNormalizedYear(int normalizedYear) {251unsupported();252}253254private void unsupported() {255throw new UnsupportedOperationException();256}257}258259260