]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Calendar.java (toString): New method.
authorTom Tromey <tromey@cygnus.com>
Thu, 3 Feb 2000 18:26:51 +0000 (18:26 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Thu, 3 Feb 2000 18:26:51 +0000 (18:26 +0000)
* java/util/Calendar.java (toString): New method.
* java/util/SimpleTimeZone.java (clone): New method.
(toString): New method.
* java/util/TimeZone.java (clone): New method.
* java/text/SimpleDateFormat.java (clone): New method.
* java/text/NumberFormat.java (clone): New method.
(equals): New method.
* java/text/Format.java (clone): New method.
* java/text/DateFormatSymbols.java (DateFormatSymbols): New
constructor.
(clone): New method.
* java/text/DateFormat.java (clone): New method.
* java/text/Collator.java (clone): New method.

From-SVN: r31775

libjava/ChangeLog
libjava/java/text/Collator.java
libjava/java/text/DateFormat.java
libjava/java/text/DateFormatSymbols.java
libjava/java/text/Format.java
libjava/java/text/NumberFormat.java
libjava/java/text/SimpleDateFormat.java
libjava/java/util/Calendar.java
libjava/java/util/SimpleTimeZone.java
libjava/java/util/TimeZone.java

index 655ea87ce18dc65162150e95e913d650303ded52..48cf22dc1f8d8b23b7e70445dd74438345e2ffb6 100644 (file)
@@ -1,3 +1,19 @@
+2000-02-03  Tom Tromey  <tromey@cygnus.com>
+
+       * java/util/Calendar.java (toString): New method.
+       * java/util/SimpleTimeZone.java (clone): New method.
+       (toString): New method.
+       * java/util/TimeZone.java (clone): New method.
+       * java/text/SimpleDateFormat.java (clone): New method.
+       * java/text/NumberFormat.java (clone): New method.
+       (equals): New method.
+       * java/text/Format.java (clone): New method.
+       * java/text/DateFormatSymbols.java (DateFormatSymbols): New
+       constructor.
+       (clone): New method.
+       * java/text/DateFormat.java (clone): New method.
+       * java/text/Collator.java (clone): New method.
+
 2000-02-03  Tom Tromey  <tromey@cygnus.com>
 
        * java/io/PipedOutputStream.java (write(byte[], int, int)): New
index 76fc08da73f030c69eabcb76b1616ab31622bb79..5453372c5bccfb7394aaf8cfb9d914af2903f5e4 100644 (file)
@@ -1,6 +1,6 @@
 // Collator.java - Locale-sensitive string comparison.
 
-/* Copyright (C) 1999  Red Hat, Inc.
+/* Copyright (C) 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -56,6 +56,11 @@ public abstract class Collator implements Cloneable, Serializable
     return compare (source, target) == 0;
   }
 
+  public Object clone ()
+  {
+    return super.clone ();
+  }
+
   public static synchronized Locale[] getAvailableLocales ()
   {
     // FIXME.
index e7bbe0cf734bd9d14565805a94f195f79c97a3c8..fe20b049302dc937dc25958762ed6e8c2d6f574a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -62,6 +62,12 @@ public abstract class DateFormat extends Format implements Cloneable
     return calendar.equals(d.calendar) && numberFormat.equals(d.numberFormat);
   }
 
+  public Object clone ()
+  {
+    // We know the superclass just call's Object's generic cloner.
+    return super.clone ();
+  }
+
   public final StringBuffer format (Object obj,
                                    StringBuffer buf, FieldPosition pos)
   {
index 75067225f00630943118288675b14d4e55ae8260..99a053e507d5d4843be75e7c09284303a5a6179d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -121,6 +121,19 @@ public class DateFormatSymbols extends Object
     this (Locale.getDefault());
   }
 
+  // Copy constructor.
+  private DateFormatSymbols (DateFormatSymbols old)
+  {
+    ampms = old.ampms;
+    eras = old.eras;
+    localPatternChars = old.localPatternChars;
+    months = old.months;
+    shortMonths = old.shortMonths;
+    shortWeekdays = old.shortWeekdays;
+    weekdays = old.weekdays;
+    zoneStrings = old.zoneStrings;
+  }
+
   public String[] getAmPmStrings()
   {
     return ampms;
@@ -251,6 +264,11 @@ public class DateFormatSymbols extends Object
            && equals(zoneStrings, other.zoneStrings));
   }
 
+  public Object clone ()
+  {
+    return new DateFormatSymbols (this);
+  }
+
   public int hashCode ()
   {
     return (hashCode(ampms)
index bd3943ad41caf86881c77ade3f6822257328d558..fda14bc755c05582064777182a0fbb955a2c34e4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -48,4 +48,9 @@ public abstract class Format implements java.io.Serializable, Cloneable
       }
     return result;
   }
+
+  public Object clone ()
+  {
+    return super.clone ();
+  }
 }
index 56615915efac8581e19bb5260b8f5f298502e986..bc96cbc9452b939ec25b09888a9a2ce2abeec0b4 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -50,6 +50,27 @@ public abstract class NumberFormat extends Format implements Cloneable
   public abstract StringBuffer format (long number,
                                       StringBuffer sbuf, FieldPosition pos);
 
+  public Object clone ()
+  {
+    // We know the superclass just uses Object's generic cloner.
+    // Why not just inherit?  Because the online docs specify that
+    // this method exists for this class.
+    return super.clone ();
+  }
+
+  public boolean equals (Object obj)
+  {
+    if (! (obj instanceof NumberFormat))
+      return false;
+    NumberFormat nf = (NumberFormat) obj;
+    return (groupingUsed == nf.groupingUsed
+           && maximumFractionDigits == nf.maximumFractionDigits
+           && maximumIntegerDigits == nf.maximumIntegerDigits
+           && minimumFractionDigits == nf.minimumFractionDigits
+           && minimumIntegerDigits == nf.minimumIntegerDigits
+           && parseIntegerOnly == nf.parseIntegerOnly);
+  }
+
   public static Locale[] getAvailableLocales ()
     {
       // FIXME.
index 7e237f79dfa2404bf23fb43bdebdc84ad7434404..f9bee8eb906ff23fdcccd528bfbd669d0d4dd1e3 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -512,6 +512,12 @@ public class SimpleDateFormat extends DateFormat
                                        other.defaultCenturyStart));
   }
 
+  public Object clone ()
+  {
+    // We know the superclass just call's Object's generic cloner.
+    return super.clone ();
+  }
+
   public int hashCode ()
   {
     int hash = super.hashCode();
index 406ccd42ee0733fa3790402f7f8a478269d60ea4..34921d0e0624768e1cebcfdab0d0a15493331417 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -108,6 +108,21 @@ public abstract class Calendar implements java.io.Serializable, Cloneable
       }
   }
 
+  public String toString ()
+  {
+    // We have much latitude in how we implement this.
+    return ("areFieldsSet " + areFieldsSet
+           + "; fields " + fields
+           + "; firstDayOfWeek " + firstDayOfWeek
+           + "; isSet " + isSet
+           + "; isTimeSet " + isTimeSet
+           + "; lenient " + lenient
+           + "; minimalDaysInFirstWeek " + minimalDaysInFirstWeek
+           + "; nextStamp " + nextStamp
+           + "; time " + time
+           + "; zone " + zone);
+  }
+
   public static Calendar getInstance ()
   {
     return new GregorianCalendar ();
index f8c831569c8f94776a68693f79041d75f4759ab4..84d43d67f64e0ee1db6e5273cf2ac43c5aa1e7c5 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -169,6 +169,32 @@ public class SimpleTimeZone extends TimeZone
     return getID() == other.getID() && hasSameRules(other);
   }
 
+  public Object clone ()
+  {
+    // We know the superclass just call's Object's generic cloner.
+    return super.clone ();
+  }
+
+  public String toString ()
+  {
+    // The docs don't say much about how we might implement this.
+    // We choose a debugging implementation.
+    return ("dstSavings " + dstSavings
+           + "; rawOffset " + rawOffset
+           + "; startDay " + startDay
+           + "; startDayOfWeek " + startDayOfWeek
+           + "; startMode " + startMode
+           + "; startMonth " + startMonth
+           + "; startTime " + startTime
+           + "; startYear " + startYear
+           + "; endDay " + endDay
+           + "; endDayOfWeek " + endDayOfWeek
+           + "; endMode " + endMode
+           + "; endMonth " + endMonth
+           + "; endTime " + endTime
+           + "; useDaylight " + useDaylight);
+  }
+
   public int hashCode ()
   {
     // FIXME - this does not folow any spec (since none is public)!
index 37e16237ce82f0fea28a52827db76759ec3e3ab4..16772adcdf32f8ea30edc8731b3ae41788fda899 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998, 1999  Red Hat, Inc.
+/* Copyright (C) 1998, 1999, 2000  Red Hat, Inc.
 
    This file is part of libgcj.
 
@@ -152,7 +152,11 @@ public abstract class TimeZone implements java.io.Serializable, Cloneable
     return this == other;
   }
 
-  // public Object clone ();
+  public Object clone ()
+  {
+    // Just use Object's generic cloner.
+    return super.clone ();
+  }
 
   // Names of timezones.  This array is kept in parallel with
   // rawOffsets.  This list comes from the JCL 1.1 book.