This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Patch: missing 1.1 methods


I'm committing this patch.  It adds a number of methods which are in
1.1 but not previously in libgcj.

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.

Tom

Index: java/text/Collator.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/Collator.java,v
retrieving revision 1.3
diff -u -r1.3 Collator.java
--- Collator.java	2000/01/19 18:39:26	1.3
+++ Collator.java	2000/02/03 18:23:10
@@ -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.
 
@@ -54,6 +54,11 @@
   public boolean equals (String source, String target)
   {
     return compare (source, target) == 0;
+  }
+
+  public Object clone ()
+  {
+    return super.clone ();
   }
 
   public static synchronized Locale[] getAvailableLocales ()
Index: java/text/DateFormat.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/DateFormat.java,v
retrieving revision 1.3
diff -u -r1.3 DateFormat.java
--- DateFormat.java	2000/01/19 18:39:26	1.3
+++ DateFormat.java	2000/02/03 18:23:10
@@ -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.
 
@@ -60,6 +60,12 @@
       return false;
     DateFormat d = (DateFormat) obj;
     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,
Index: java/text/DateFormatSymbols.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/DateFormatSymbols.java,v
retrieving revision 1.2
diff -u -r1.2 DateFormatSymbols.java
--- DateFormatSymbols.java	2000/01/19 18:39:26	1.2
+++ DateFormatSymbols.java	2000/02/03 18:23:15
@@ -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 @@
     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;
@@ -249,6 +262,11 @@
 	    && equals(shortWeekdays, other.shortWeekdays)
 	    && equals(weekdays, other.weekdays)
 	    && equals(zoneStrings, other.zoneStrings));
+  }
+
+  public Object clone ()
+  {
+    return new DateFormatSymbols (this);
   }
 
   public int hashCode ()
Index: java/text/Format.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/Format.java,v
retrieving revision 1.2
diff -u -r1.2 Format.java
--- Format.java	2000/01/19 18:39:26	1.2
+++ Format.java	2000/02/03 18:23:15
@@ -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.
 
@@ -47,5 +47,10 @@
 	throw new ParseException("parseObject failed", index);
       }
     return result;
+  }
+
+  public Object clone ()
+  {
+    return super.clone ();
   }
 }
Index: java/text/NumberFormat.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/NumberFormat.java,v
retrieving revision 1.3
diff -u -r1.3 NumberFormat.java
--- NumberFormat.java	2000/01/19 18:39:27	1.3
+++ NumberFormat.java	2000/02/03 18:23:15
@@ -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.
 
@@ -49,6 +49,27 @@
 
   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 ()
     {
Index: java/text/SimpleDateFormat.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/text/SimpleDateFormat.java,v
retrieving revision 1.2
diff -u -r1.2 SimpleDateFormat.java
--- SimpleDateFormat.java	2000/01/19 18:39:27	1.2
+++ SimpleDateFormat.java	2000/02/03 18:23:18
@@ -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.
 
@@ -510,6 +510,12 @@
 	    && DateFormatSymbols.equals(formatData, other.formatData)
 	    && DateFormatSymbols.equals(defaultCenturyStart,
 					other.defaultCenturyStart));
+  }
+
+  public Object clone ()
+  {
+    // We know the superclass just call's Object's generic cloner.
+    return super.clone ();
   }
 
   public int hashCode ()
Index: java/util/Calendar.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/Calendar.java,v
retrieving revision 1.4
diff -u -r1.4 Calendar.java
--- Calendar.java	2000/01/19 18:39:27	1.4
+++ Calendar.java	2000/02/03 18:23:18
@@ -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.
 
@@ -106,6 +106,21 @@
       {
 	throw new RuntimeException("internal error - "+ex);
       }
+  }
+
+  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 ()
Index: java/util/SimpleTimeZone.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/SimpleTimeZone.java,v
retrieving revision 1.2
diff -u -r1.2 SimpleTimeZone.java
--- SimpleTimeZone.java	2000/01/19 18:39:27	1.2
+++ SimpleTimeZone.java	2000/02/03 18:23:18
@@ -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.
 
@@ -167,6 +167,32 @@
       return false;
     SimpleTimeZone other = (SimpleTimeZone) obj;
     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 ()
Index: java/util/TimeZone.java
===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/TimeZone.java,v
retrieving revision 1.3
diff -u -r1.3 TimeZone.java
--- TimeZone.java	2000/01/19 18:39:27	1.3
+++ TimeZone.java	2000/02/03 18:23:20
@@ -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 @@
     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.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]