2005-11-21 Kendall Bell [EMAIL PROTECTED]
* java/util/Calendar.java: Implemented Comparable.
/* Calendar.java --
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
package java.util;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
/**
* This class is an abstract base class for Calendars, which can be
* used to convert between codeDate/code objects and a set of
* integer fields which represent codeYEAR/code,
* codeMONTH/code, codeDAY/code, etc. The codeDate/code
* object represents a time in milliseconds since the Epoch. br
*
* This class is locale sensitive. To get the Object matching the
* current locale you can use codegetInstance/code. You can even provide
* a locale or a timezone. codegetInstance/code returns currently
* a codeGregorianCalendar/code for the current date. br
*
* If you want to convert a date from the Year, Month, Day, DayOfWeek,
* etc. Representation to a codeDate/code-Object, you can create
* a new Calendar with codegetInstance()/code,
* codeclear()/code all fields, codeset(int,int)/code the
* fields you need and convert it with codegetTime()/code. br
*
* If you want to convert a codeDate/code-object to the Calendar
* representation, create a new Calendar, assign the
* codeDate/code-Object with codesetTime()/code, and read the
* fields with codeget(int)/code. br
*
* When computing the date from time fields, it may happen, that there
* are either two few fields set, or some fields are inconsistent. This
* cases will handled in a calendar specific way. Missing fields are
* replaced by the fields of the epoch: 1970 January 1 00:00. br
*
* To understand, how the day of year is computed out of the fields
* look at the following table. It is traversed from top to bottom,
* and for the first line all fields are set, that line is used to
* compute the day. br
*
*
premonth + day_of_month
month + week_of_month + day_of_week
month + day_of_week_of_month + day_of_week
day_of_year
day_of_week + week_of_year/pre
*
* The hour_of_day-field takes precedence over the ampm and
* hour_of_ampm fields. br
*
* STRONGNote:/STRONG This can differ for non-Gregorian calendar. br
*
* To convert a calendar to a human readable form and vice versa, use
* the codejava.text.DateFormat/code class. br
*
* Other useful things you can do with an calendar, is
* coderoll/codeing fields (that means increase/decrease a
* specific field by one, propagating overflows), or
* codeadd/codeing/substracting a fixed amount to a field.
*
* @see Date
* @see GregorianCalendar
* @see TimeZone
* @see java.text.DateFormat
*/
public abstract class Calendar implements Serializable, Cloneable
{
/**
* Constant representing the era time field.
*/
public static final int ERA = 0;
/**
* Constant representing the year time field.
*/
public static final int YEAR = 1;
/**
* Constant representing the month time field. This field
* should contain one of the JANUARY,...,DECEMBER constants below.
*/
public static final int MONTH = 2;
/**
* Constant representing the week of the year field.
* @see