Merged gcj-eclipse branch to trunk.

From-SVN: r120621
This commit is contained in:
Tom Tromey 2007-01-09 19:58:05 +00:00
parent c648dedbde
commit 97b8365caf
17478 changed files with 606493 additions and 100744 deletions

View file

@ -1,5 +1,6 @@
/* Calendar.java --
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
Copyright (C) 1998, 1999, 2000, 2001, 2002, 2004, 2005, 2006,
Free Software Foundation, Inc.
This file is part of GNU Classpath.
@ -103,7 +104,8 @@ day_of_week + week_of_year</pre>
* @see TimeZone
* @see java.text.DateFormat
*/
public abstract class Calendar implements Serializable, Cloneable
public abstract class Calendar
implements Serializable, Cloneable, Comparable<Calendar>
{
/**
* Constant representing the era time field.
@ -483,6 +485,8 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Creates a calendar representing the actual time, using the default
* time zone and locale.
*
* @return The new calendar.
*/
public static synchronized Calendar getInstance()
{
@ -492,7 +496,12 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Creates a calendar representing the actual time, using the given
* time zone and the default locale.
* @param zone a time zone.
*
* @param zone a time zone (<code>null</code> not permitted).
*
* @return The new calendar.
*
* @throws NullPointerException if <code>zone</code> is <code>null</code>.
*/
public static synchronized Calendar getInstance(TimeZone zone)
{
@ -502,7 +511,12 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Creates a calendar representing the actual time, using the default
* time zone and the given locale.
* @param locale a locale.
*
* @param locale a locale (<code>null</code> not permitted).
*
* @return The new calendar.
*
* @throws NullPointerException if <code>locale</code> is <code>null</code>.
*/
public static synchronized Calendar getInstance(Locale locale)
{
@ -524,8 +538,14 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Creates a calendar representing the actual time, using the given
* time zone and locale.
* @param zone a time zone.
* @param locale a locale.
*
* @param zone a time zone (<code>null</code> not permitted).
* @param locale a locale (<code>null</code> not permitted).
*
* @return The new calendar.
*
* @throws NullPointerException if <code>zone</code> or <code>locale</code>
* is <code>null</code>.
*/
public static synchronized Calendar getInstance(TimeZone zone, Locale locale)
{
@ -617,6 +637,10 @@ public abstract class Calendar implements Serializable, Cloneable
/**
* Sets this Calendar's time to the given Date. All time fields
* are invalidated by this method.
*
* @param date the date (<code>null</code> not permitted).
*
* @throws NullPointerException if <code>date</code> is <code>null</code>.
*/
public final void setTime(Date date)
{
@ -1195,6 +1219,31 @@ public abstract class Calendar implements Serializable, Cloneable
return max;
}
/**
* Compares the time of two calendar instances.
* @param calendar the calendar to which the time should be compared.
* @return 0 if the two calendars are set to the same time,
* less than 0 if the time of this calendar is before that of
* <code>cal</code>, or more than 0 if the time of this calendar is after
* that of <code>cal</code>.
*
* @param cal the calendar to compare this instance with.
* @throws NullPointerException if <code>cal</code> is null.
* @throws IllegalArgumentException if either calendar has fields set to
* invalid values.
* @since 1.5
*/
public int compareTo(Calendar cal)
{
long t1 = getTimeInMillis();
long t2 = cal.getTimeInMillis();
if(t1 == t2)
return 0;
if(t1 > t2)
return 1;
return -1;
}
/**
* Return a clone of this object.
*/