diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-02-03 18:26:51 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-02-03 18:26:51 +0000 |
commit | 14447d9674516f64525e963cf08134db330dc304 (patch) | |
tree | 85aea7711b50644d2a0b864b59738c7489ebc02b /libjava/java/text | |
parent | 7d3151e1c97ed21842b759aedecbc34588f85112 (diff) | |
download | gcc-14447d9674516f64525e963cf08134db330dc304.zip gcc-14447d9674516f64525e963cf08134db330dc304.tar.gz gcc-14447d9674516f64525e963cf08134db330dc304.tar.bz2 |
Calendar.java (toString): New method.
* 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
Diffstat (limited to 'libjava/java/text')
-rw-r--r-- | libjava/java/text/Collator.java | 7 | ||||
-rw-r--r-- | libjava/java/text/DateFormat.java | 8 | ||||
-rw-r--r-- | libjava/java/text/DateFormatSymbols.java | 20 | ||||
-rw-r--r-- | libjava/java/text/Format.java | 7 | ||||
-rw-r--r-- | libjava/java/text/NumberFormat.java | 23 | ||||
-rw-r--r-- | libjava/java/text/SimpleDateFormat.java | 8 |
6 files changed, 67 insertions, 6 deletions
diff --git a/libjava/java/text/Collator.java b/libjava/java/text/Collator.java index 76fc08d..5453372 100644 --- a/libjava/java/text/Collator.java +++ b/libjava/java/text/Collator.java @@ -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. diff --git a/libjava/java/text/DateFormat.java b/libjava/java/text/DateFormat.java index e7bbe0c..fe20b04 100644 --- a/libjava/java/text/DateFormat.java +++ b/libjava/java/text/DateFormat.java @@ -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) { diff --git a/libjava/java/text/DateFormatSymbols.java b/libjava/java/text/DateFormatSymbols.java index 7506722..99a053e 100644 --- a/libjava/java/text/DateFormatSymbols.java +++ b/libjava/java/text/DateFormatSymbols.java @@ -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) diff --git a/libjava/java/text/Format.java b/libjava/java/text/Format.java index bd3943a..fda14bc 100644 --- a/libjava/java/text/Format.java +++ b/libjava/java/text/Format.java @@ -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 (); + } } diff --git a/libjava/java/text/NumberFormat.java b/libjava/java/text/NumberFormat.java index 5661591..bc96cbc 100644 --- a/libjava/java/text/NumberFormat.java +++ b/libjava/java/text/NumberFormat.java @@ -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. diff --git a/libjava/java/text/SimpleDateFormat.java b/libjava/java/text/SimpleDateFormat.java index 7e237f7..f9bee8e 100644 --- a/libjava/java/text/SimpleDateFormat.java +++ b/libjava/java/text/SimpleDateFormat.java @@ -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(); |