[kaffe] CVS kaffe (dalibor): Resynced with GNU Classpath

Kaffe CVS cvs-commits at kaffe.org
Fri Jan 2 20:24:02 PST 2004


PatchSet 4274 
Date: 2004/01/03 04:07:08
Author: dalibor
Branch: HEAD
Tag: (none) 
Log:
Resynced with GNU Classpath

2004-01-03  Dalibor Topic <robilad at kaffe.org>

        Resynced with GNU Classpath.

        2003-12-26  Michael Koch  <konqueror at gmx.de>

        * java/text/NumberFormat.java
        (getCurrency): New method.
        (setCurrency): New method.

        2003-11-23  Guilhem Lavaux <guilhem at kaffe.org>

        * java/text/NumberFormat.java:
        (getIntegerInstance) Added the java version in the comments.

        * java/text/FormatCharacterIterator.java: Documented the class and
        its methods.

        2003-11-23  Mark Wielaard  <mark at klomp.org>

        * java/text/NumberFormat.java: Import java.io.InvalidObjectException.
        (readResolve): Reformat.

        2003-11-22  Guilhem Lavaux <guilhem at kaffe.org>

        * java/text/NumberFormat.java
        (NumberFormat.Field): New implemented class to match Java 1.4.
        (getIntegerInstance): Two new Java 1.4 methods.o

        2001-09-04  Tom Tromey  <tromey at redhat.com>

        * java/text/NumberFormat.java: Merged with libgcj.

Members: 
	ChangeLog:1.1861->1.1862 
	libraries/javalib/java/text/NumberFormat.java:1.18->1.19 

Index: kaffe/ChangeLog
diff -u kaffe/ChangeLog:1.1861 kaffe/ChangeLog:1.1862
--- kaffe/ChangeLog:1.1861	Sat Jan  3 03:56:50 2004
+++ kaffe/ChangeLog	Sat Jan  3 04:07:08 2004
@@ -4,6 +4,39 @@
 
 	2003-12-26  Michael Koch  <konqueror at gmx.de>
 
+        * java/text/NumberFormat.java
+        (getCurrency): New method.
+        (setCurrency): New method.
+
+	2003-11-23  Guilhem Lavaux <guilhem at kaffe.org>
+
+        * java/text/NumberFormat.java:
+        (getIntegerInstance) Added the java version in the comments.
+
+        * java/text/FormatCharacterIterator.java: Documented the class and
+        its methods.
+
+	2003-11-23  Mark Wielaard  <mark at klomp.org>
+
+        * java/text/NumberFormat.java: Import java.io.InvalidObjectException.
+        (readResolve): Reformat.
+
+	2003-11-22  Guilhem Lavaux <guilhem at kaffe.org>
+
+        * java/text/NumberFormat.java
+        (NumberFormat.Field): New implemented class to match Java 1.4.
+        (getIntegerInstance): Two new Java 1.4 methods.o
+
+	2001-09-04  Tom Tromey  <tromey at redhat.com>
+
+        * java/text/NumberFormat.java: Merged with libgcj.
+
+2004-01-03  Dalibor Topic <robilad at kaffe.org>
+
+	Resynced with GNU Classpath.
+
+	2003-12-26  Michael Koch  <konqueror at gmx.de>
+
         * java/text/Format.java (serialVersionUID): Fixed value.
 
 2004-01-03  Dalibor Topic <robilad at kaffe.org>
Index: kaffe/libraries/javalib/java/text/NumberFormat.java
diff -u kaffe/libraries/javalib/java/text/NumberFormat.java:1.18 kaffe/libraries/javalib/java/text/NumberFormat.java:1.19
--- kaffe/libraries/javalib/java/text/NumberFormat.java:1.18	Wed Aug 27 14:32:10 2003
+++ kaffe/libraries/javalib/java/text/NumberFormat.java	Sat Jan  3 04:07:10 2004
@@ -1,5 +1,5 @@
 /* NumberFormat.java -- Formats and parses numbers
-   Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -38,14 +38,14 @@
 
 package java.text;
 
-import java.util.Locale;
-import java.util.ResourceBundle;
-import java.util.MissingResourceException;
-import java.util.Currency;
+import java.io.InvalidObjectException;
+import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
-import java.io.IOException;
-import java.io.InvalidObjectException;
+import java.util.Currency;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
 
 /**
  * This is the abstract superclass of all classes which format and 
@@ -89,61 +89,76 @@
      * Attribute set to all characters containing digits of the integer
      * part.
      */
-    public static final NumberFormat.Field INTEGER = new Field("integer");
+    public static final NumberFormat.Field INTEGER
+      = new Field("integer");
 
     /**
      * Attribute set to all characters containing digits of the fractional
      * part.
      */
-    public static final NumberFormat.Field FRACTION = new Field("fraction");
+    public static final NumberFormat.Field FRACTION
+      = new Field("fraction");
 
     /**
      * Attribute set to all characters containing digits of the exponential
      * part.
      */
-    public static final NumberFormat.Field EXPONENT = new Field("exponent");
+    public static final NumberFormat.Field EXPONENT
+      = new Field("exponent");
 
     /**
      * Attribute set to all characters containing a decimal separator.
      */
-    public static final NumberFormat.Field DECIMAL_SEPARATOR = new Field("decimal separator");
+    public static final NumberFormat.Field DECIMAL_SEPARATOR
+      = new Field("decimal separator");
 
     /**
      * Attribute set to all characters containing a sign (plus or minus).
      */
-    public static final NumberFormat.Field SIGN = new Field("sign");
+    public static final NumberFormat.Field SIGN
+      = new Field("sign");
 
     /**
-     * Attribute set to all characters containing a grouping separator (e.g. a comma,
-     * a white space,...).
+     * Attribute set to all characters containing a grouping separator (e.g.
+     * a comma, a white space,...).
      */
-    public static final NumberFormat.Field GROUPING_SEPARATOR = new Field("grouping separator");
+    public static final NumberFormat.Field GROUPING_SEPARATOR
+      = new Field("grouping separator");
 
     /**
-     * Attribute set to all characters containing an exponential symbol (e.g. 'E')
+     * Attribute set to all characters containing an exponential symbol (e.g.
+     * 'E')
      */
-    public static final NumberFormat.Field EXPONENT_SYMBOL = new Field("exponent symbol");
+    public static final NumberFormat.Field EXPONENT_SYMBOL
+      = new Field("exponent symbol");
 
     /**
      * Attribute set to all characters containing a percent symbol (e.g. '%')
      */
-    public static final NumberFormat.Field PERCENT = new Field("percent");
+    public static final NumberFormat.Field PERCENT
+      = new Field("percent");
 
     /**
      * Attribute set to all characters containing a permille symbol.
      */
-    public static final NumberFormat.Field PERMILLE = new Field("permille");
+    public static final NumberFormat.Field PERMILLE
+      = new Field("permille");
 
     /**
      * Attribute set to all characters containing the currency unit.
      */
-    public static final NumberFormat.Field CURRENCY = new Field("currency");
+    public static final NumberFormat.Field CURRENCY
+      = new Field("currency");
 
     /**
      * Attribute set to all characters containing the exponent sign.
      */
-    public static final NumberFormat.Field EXPONENT_SIGN = new Field("exponent sign");
+    public static final NumberFormat.Field EXPONENT_SIGN
+      = new Field("exponent sign");
 
+    /**
+     * Private fields to register all fields contained in this descriptor.
+     */
     private static final NumberFormat.Field[] allFields =
     {
       INTEGER, FRACTION, EXPONENT, DECIMAL_SEPARATOR, SIGN,
@@ -151,25 +166,44 @@
       PERMILLE, CURRENCY, EXPONENT_SIGN
     };
 
-    // For deserialization purpose
+    /**
+     * This constructor is only used by the deserializer. Without it,
+     * it would fail to construct a valid object.
+     */
     private Field()
     {
       super("");
     }
-    
-    private Field(String s)
+
+    /**
+     * Create a Field instance with the specified field name.
+     *
+     * @param field_name Field name for the new Field instance.
+     */
+    protected Field(String field_name)
     {
-      super(s);
+      super (field_name);
     }
 
+    /**
+     * This function is used by the deserializer to know which object
+     * to use when it encounters an encoded NumberFormat.Field in a 
+     * serialization stream. If the stream is valid it should return
+     * one of the above field. In the other case we throw an exception.
+     *
+     * @return a valid official NumberFormat.Field instance.
+     *
+     * @throws InvalidObjectException if the field name is invalid.
+     */
     protected Object readResolve() throws InvalidObjectException
     {
       String s = getName();
-      for (int i=0;i<allFields.length;i++)
+      for (int i = 0; i < allFields.length; i++)
 	if (s.equals(allFields[i].getName()))
 	  return allFields[i];
 
-      throw new InvalidObjectException("no such NumberFormat field called " + s);
+      throw new InvalidObjectException("no such NumberFormat field called "
+				       + s);
     }
   }
 
@@ -317,16 +351,6 @@
     return computeInstance (loc, "currencyFormat", "$#,##0.00;($#,##0.00)");
   }
 
-  public Currency getCurrency()
-  {
-    throw new UnsupportedOperationException("getCurrency");
-  }
-
-  public void setCurrency(Currency currency)
-  {
-    throw new UnsupportedOperationException("setCurrency");    
-  }
-
   /**
    * This method returns a default instance for the default locale. This
    * will be a concrete subclass of <code>NumberFormat</code>, but the 
@@ -407,6 +431,8 @@
    * will be a concrete subclass of <code>NumberFormat</code>, but the 
    * actual class returned is dependent on the locale.
    *
+   * @param locale The desired locale.
+   *
    * @return An instance of the default <code>NumberFormat</code> class.
    */
   public static final NumberFormat getNumberInstance ()
@@ -420,9 +446,7 @@
    * <code>NumberFormat</code>, but the actual class returned is dependent
    * on the locale.
    *
-   * @param loc the desired locale.
-   *
-   * @return An instance of a generic number formatter for the specified locale.
+   * @return An instance of a generic number formatter for the default locale.
    */
   public static NumberFormat getNumberInstance (Locale loc)
   {
@@ -435,6 +459,7 @@
    * but the actual class returned is dependent on the locale.
    *
    * @return An instance of an integer number formatter for the default locale.
+   * @since 1.4 
    */
   public static final NumberFormat getIntegerInstance()
   {
@@ -446,13 +471,14 @@
    * default locale. This will be a concrete subclass of <code>NumberFormat</code>,
    * but the actual class returned is dependent on the locale.
    *
-   * @param loc the desired locale.
+   * @param locale the desired locale.
    *
-   * @return An instance of an integer number formatter for the default locale.
+   * @return An instance of an integer number formatter for the desired locale.
+   * @since 1.4 
    */
-  public static NumberFormat getIntegerInstance(Locale loc)
+  public static NumberFormat getIntegerInstance(Locale locale)
   {
-    NumberFormat format = computeInstance (loc, "numberFormat", "#,##0");
+    NumberFormat format = computeInstance (locale, "numberFormat", "#,##0");
     format.setParseIntegerOnly (true);
     return format;
   }
@@ -734,5 +760,45 @@
       (byte) minimumIntegerDigits : Byte.MAX_VALUE;
     serialVersionOnStream = 1;
     stream.defaultWriteObject();
+  }
+
+  /**
+   * Returns the currency used by this number format when formatting currency
+   * values.
+   *
+   * The default implementation throws UnsupportedOperationException.
+   *
+   * @return The used currency object, or null.
+   *
+   * @throws UnsupportedOperationException If the number format class doesn't
+   * implement currency formatting.
+   *
+   * @since 1.4
+   */
+  public Currency getCurrency()
+  {
+    throw new UnsupportedOperationException();
+  }
+
+  /**
+   * Sets the currency used by this number format when formatting currency
+   * values.
+   *
+   * The default implementation throws UnsupportedOperationException.
+   *
+   * @param currency The new currency to be used by this number format.
+   *
+   * @throws NullPointerException If currenc is null.
+   * @throws UnsupportedOperationException If the number format class doesn't
+   * implement currency formatting.
+   *
+   * @since 1.4
+   */
+  public void setCurreny(Currency currency)
+  {
+    if (currency == null)
+      throw new NullPointerException("currency may not be null");
+    
+    throw new UnsupportedOperationException();
   }
 }




More information about the kaffe mailing list