From 1ea63ef8be1cc54dd0de9d82c684713a1dcf1e06 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 23 Sep 2005 21:31:04 +0000 Subject: Imported Classpath 0.18. * sources.am, Makefile.in: Updated. * Makefile.am (nat_source_files): Removed natProxy.cc. * java/lang/reflect/natProxy.cc: Removed. * gnu/classpath/jdwp/VMFrame.java, gnu/classpath/jdwp/VMIdManager.java, gnu/classpath/jdwp/VMVirtualMachine.java, java/lang/reflect/VMProxy.java: New files. 2005-09-23 Thomas Fitzsimmons * scripts/makemake.tcl (verbose): Add gnu/java/awt/peer/qt to BC list. 2005-09-23 Thomas Fitzsimmons * gnu/java/net/DefaultContentHandlerFactory.java (getContent): Remove ClasspathToolkit references. 2005-09-23 Thomas Fitzsimmons * gnu/awt/xlib/XCanvasPeer.java: Add new peer methods. * gnu/awt/xlib/XFramePeer.java: Likewise. * gnu/awt/xlib/XGraphicsConfiguration.java: Likewise. 2005-09-23 Thomas Fitzsimmons * Makefile.am (libgcjawt_la_SOURCES): Remove jawt.c. Add classpath/native/jawt/jawt.c. * Makefile.in: Regenerate. * jawt.c: Remove file. * include/Makefile.am (tool_include__HEADERS): Remove jawt.h and jawt_md.h. Add ../classpath/include/jawt.h and ../classpath/include/jawt_md.h. * include/Makefile.in: Regenerate. * include/jawt.h: Regenerate. * include/jawt_md.h: Regenerate. From-SVN: r104586 --- libjava/classpath/java/text/DateFormat.java | 52 +++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 13 deletions(-) (limited to 'libjava/classpath/java/text/DateFormat.java') diff --git a/libjava/classpath/java/text/DateFormat.java b/libjava/classpath/java/text/DateFormat.java index f6dfceb14e8..5d412aada52 100644 --- a/libjava/classpath/java/text/DateFormat.java +++ b/libjava/classpath/java/text/DateFormat.java @@ -405,8 +405,18 @@ public abstract class DateFormat extends Format implements Cloneable *
    *
  • Is not null.
  • *
  • Is an instance of DateFormat.
  • - *
  • Has the same numberFormat field value as this object.
  • + *
  • Has equal numberFormat field as this object.
  • + *
  • Has equal (Calendar) TimeZone rules as this object.
  • + *
  • Has equal (Calendar) isLenient results.
  • + *
  • Has equal Calendar first day of week and minimal days in week + * values.
  • *
+ * Note that not all properties of the Calendar are relevant for a + * DateFormat. For formatting only the fact whether or not the + * TimeZone has the same rules and whether the calendar is lenient + * and has the same week rules is compared for this implementation + * of equals. Other properties of the Calendar (such as the time) + * are not taken into account. * * @param obj The object to test for equality against. * @@ -419,8 +429,24 @@ public abstract class DateFormat extends Format implements Cloneable return false; DateFormat d = (DateFormat) obj; - - return numberFormat.equals(d.numberFormat); + TimeZone tz = getTimeZone(); + TimeZone tzd = d.getTimeZone(); + if (tz.hasSameRules(tzd)) + if (isLenient() == d.isLenient()) + { + Calendar c = getCalendar(); + Calendar cd = d.getCalendar(); + if ((c == null && cd == null) + || + (c.getFirstDayOfWeek() == cd.getFirstDayOfWeek() + && + c.getMinimalDaysInFirstWeek() + == cd.getMinimalDaysInFirstWeek())) + return ((numberFormat == null && d.numberFormat == null) + || numberFormat.equals(d.numberFormat)); + } + + return false; } /** @@ -442,9 +468,9 @@ public abstract class DateFormat extends Format implements Cloneable * thrown. * * @param obj The Object to format. - * @param toAppendTo The StringBuffer to append the resultant + * @param buf The StringBuffer to append the resultant * String to. - * @param fieldPosition Is updated to the start and end index of the + * @param pos Is updated to the start and end index of the * specified field. * * @return The StringBuffer supplied on input, with the @@ -479,9 +505,9 @@ public abstract class DateFormat extends Format implements Cloneable * to the specified StringBuffer. * * @param date The Date value to format. - * @param toAppendTo The StringBuffer to append the resultant + * @param buf The StringBuffer to append the resultant * String to. - * @param fieldPosition Is updated to the start and end index of the + * @param pos Is updated to the start and end index of the * specified field. * * @return The StringBuffer supplied on input, with the @@ -643,7 +669,7 @@ public abstract class DateFormat extends Format implements Cloneable * localed will be used in place of the default. * * @param style The type of formatting to perform. - * @param aLocale The desired locale. + * @param loc The desired locale. * * @return A new DateFormat instance. */ @@ -744,7 +770,7 @@ public abstract class DateFormat extends Format implements Cloneable * localed will be used in place of the default. * * @param style The type of formatting to perform. - * @param aLocale The desired locale. + * @param loc The desired locale. * * @return A new DateFormat instance. */ @@ -818,7 +844,7 @@ public abstract class DateFormat extends Format implements Cloneable * starting parse position on method entry and the ending parse * position on method exit. * - * @param text The string to parse. + * @param source The string to parse. * @param pos The starting parse position in entry, the ending parse * position on exit. * @@ -848,7 +874,7 @@ public abstract class DateFormat extends Format implements Cloneable * This method specified the Calendar that should be used * by this object to parse/format datetimes. * - * @param The new Calendar for this object. + * @param calendar The new Calendar for this object. * * @see java.util.Calendar */ @@ -873,7 +899,7 @@ public abstract class DateFormat extends Format implements Cloneable * This method specifies the NumberFormat object that should * be used by this object to parse/format times. * - * @param The NumberFormat in use by this object. + * @param numberFormat The NumberFormat in use by this object. */ public void setNumberFormat (NumberFormat numberFormat) { @@ -883,7 +909,7 @@ public abstract class DateFormat extends Format implements Cloneable /** * This method sets the time zone that should be used by this object. * - * @param The new time zone. + * @param timeZone The new time zone. */ public void setTimeZone (TimeZone timeZone) { -- cgit v1.2.3