You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2006/10/11 00:18:37 UTC

svn commit: r462605 [3/8] - in /incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java: java/text/ org/apache/harmony/text/ org/apache/harmony/text/internal/nls/

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormat.java Tue Oct 10 15:18:35 2006
@@ -33,692 +33,706 @@
  */
 public abstract class DateFormat extends Format {
 
-	private static final long serialVersionUID = 7218322306649953788L;
+    private static final long serialVersionUID = 7218322306649953788L;
 
-	protected Calendar calendar;
+    protected Calendar calendar;
 
-	protected NumberFormat numberFormat;
+    protected NumberFormat numberFormat;
 
-	/**
-	 * Format style constant.
-	 */
-	public final static int DEFAULT = 2;
-
-	/**
-	 * Format style constant.
-	 */
-	public final static int FULL = 0;
-
-	/**
-	 * Format style constant.
-	 */
-	public final static int LONG = 1;
-
-	/**
-	 * Format style constant.
-	 */
-	public final static int MEDIUM = 2;
-
-	/**
-	 * Format style constant.
-	 */
-	public final static int SHORT = 3;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int ERA_FIELD = 0;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int YEAR_FIELD = 1;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int MONTH_FIELD = 2;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int DATE_FIELD = 3;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int HOUR_OF_DAY1_FIELD = 4;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int HOUR_OF_DAY0_FIELD = 5;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int MINUTE_FIELD = 6;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int SECOND_FIELD = 7;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int MILLISECOND_FIELD = 8;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int DAY_OF_WEEK_FIELD = 9;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int DAY_OF_YEAR_FIELD = 10;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int WEEK_OF_YEAR_FIELD = 12;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int WEEK_OF_MONTH_FIELD = 13;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int AM_PM_FIELD = 14;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int HOUR1_FIELD = 15;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int HOUR0_FIELD = 16;
-
-	/**
-	 * Field constant.
-	 */
-	public final static int TIMEZONE_FIELD = 17;
-
-	/**
-	 * Constructs a new instance of DateFormat.
-	 * 
-	 */
-	protected DateFormat() {
-	}
-
-	/**
-	 * Answers a new instance of DateFormat with the same properties.
-	 * 
-	 * @return a shallow copy of this DateFormat
-	 * 
-	 * @see java.lang.Cloneable
-	 */
-	public Object clone() {
-		DateFormat clone = (DateFormat) super.clone();
-		clone.calendar = (Calendar) calendar.clone();
-		clone.numberFormat = (NumberFormat) numberFormat.clone();
-		return clone;
-	}
-
-	/**
-	 * Compares the specified object to this DateFormat and answer if they are
-	 * equal. The object must be an instance of DateFormat with the same
-	 * properties.
-	 * 
-	 * @param object
-	 *            the object to compare with this object
-	 * @return true if the specified object is equal to this DateFormat, false
-	 *         otherwise
-	 * 
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object) {
-		if (this == object) {
+    /**
+     * Format style constant.
+     */
+    public final static int DEFAULT = 2;
+
+    /**
+     * Format style constant.
+     */
+    public final static int FULL = 0;
+
+    /**
+     * Format style constant.
+     */
+    public final static int LONG = 1;
+
+    /**
+     * Format style constant.
+     */
+    public final static int MEDIUM = 2;
+
+    /**
+     * Format style constant.
+     */
+    public final static int SHORT = 3;
+
+    /**
+     * Field constant.
+     */
+    public final static int ERA_FIELD = 0;
+
+    /**
+     * Field constant.
+     */
+    public final static int YEAR_FIELD = 1;
+
+    /**
+     * Field constant.
+     */
+    public final static int MONTH_FIELD = 2;
+
+    /**
+     * Field constant.
+     */
+    public final static int DATE_FIELD = 3;
+
+    /**
+     * Field constant.
+     */
+    public final static int HOUR_OF_DAY1_FIELD = 4;
+
+    /**
+     * Field constant.
+     */
+    public final static int HOUR_OF_DAY0_FIELD = 5;
+
+    /**
+     * Field constant.
+     */
+    public final static int MINUTE_FIELD = 6;
+
+    /**
+     * Field constant.
+     */
+    public final static int SECOND_FIELD = 7;
+
+    /**
+     * Field constant.
+     */
+    public final static int MILLISECOND_FIELD = 8;
+
+    /**
+     * Field constant.
+     */
+    public final static int DAY_OF_WEEK_FIELD = 9;
+
+    /**
+     * Field constant.
+     */
+    public final static int DAY_OF_YEAR_FIELD = 10;
+
+    /**
+     * Field constant.
+     */
+    public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11;
+
+    /**
+     * Field constant.
+     */
+    public final static int WEEK_OF_YEAR_FIELD = 12;
+
+    /**
+     * Field constant.
+     */
+    public final static int WEEK_OF_MONTH_FIELD = 13;
+
+    /**
+     * Field constant.
+     */
+    public final static int AM_PM_FIELD = 14;
+
+    /**
+     * Field constant.
+     */
+    public final static int HOUR1_FIELD = 15;
+
+    /**
+     * Field constant.
+     */
+    public final static int HOUR0_FIELD = 16;
+
+    /**
+     * Field constant.
+     */
+    public final static int TIMEZONE_FIELD = 17;
+
+    /**
+     * Constructs a new instance of DateFormat.
+     * 
+     */
+    protected DateFormat() {
+    }
+
+    /**
+     * Answers a new instance of DateFormat with the same properties.
+     * 
+     * @return a shallow copy of this DateFormat
+     * 
+     * @see java.lang.Cloneable
+     */
+    @Override
+    public Object clone() {
+        DateFormat clone = (DateFormat) super.clone();
+        clone.calendar = (Calendar) calendar.clone();
+        clone.numberFormat = (NumberFormat) numberFormat.clone();
+        return clone;
+    }
+
+    /**
+     * Compares the specified object to this DateFormat and answer if they are
+     * equal. The object must be an instance of DateFormat with the same
+     * properties.
+     * 
+     * @param object
+     *            the object to compare with this object
+     * @return true if the specified object is equal to this DateFormat, false
+     *         otherwise
+     * 
+     * @see #hashCode
+     */
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
             return true;
         }
-		if (!(object instanceof DateFormat)) {
+        if (!(object instanceof DateFormat)) {
             return false;
         }
-		DateFormat dateFormat = (DateFormat) object;
-		return numberFormat.equals(dateFormat.numberFormat)
-				&& calendar.getTimeZone().equals(
-						dateFormat.calendar.getTimeZone())
-				&& calendar.getFirstDayOfWeek() == dateFormat.calendar
-						.getFirstDayOfWeek()
-				&& calendar.getMinimalDaysInFirstWeek() == dateFormat.calendar
-						.getMinimalDaysInFirstWeek()
-				&& calendar.isLenient() == dateFormat.calendar.isLenient();
-	}
-
-	/**
-	 * Formats the specified object into the specified StringBuffer using the
-	 * rules of this DateFormat. If the field specified by the FieldPosition is
-	 * formatted, set the begin and end index of the formatted field in the
-	 * FieldPosition.
-	 * 
-	 * @param object
-	 *            the object to format, must be a Date or a Number. If the
-	 *            object is a Number, a Date is constructed using the
-	 *            <code>longValue()</code> of the Number.
-	 * @param buffer
-	 *            the StringBuffer
-	 * @param field
-	 *            the FieldPosition
-	 * @return the StringBuffer parameter <code>buffer</code>
-	 * 
-	 * @exception IllegalArgumentException
-	 *                when the object is not a Date or a Number
-	 */
-	public final StringBuffer format(Object object, StringBuffer buffer,
-			FieldPosition field) {
-		if (object instanceof Date) {
+        DateFormat dateFormat = (DateFormat) object;
+        return numberFormat.equals(dateFormat.numberFormat)
+                && calendar.getTimeZone().equals(
+                        dateFormat.calendar.getTimeZone())
+                && calendar.getFirstDayOfWeek() == dateFormat.calendar
+                        .getFirstDayOfWeek()
+                && calendar.getMinimalDaysInFirstWeek() == dateFormat.calendar
+                        .getMinimalDaysInFirstWeek()
+                && calendar.isLenient() == dateFormat.calendar.isLenient();
+    }
+
+    /**
+     * Formats the specified object into the specified StringBuffer using the
+     * rules of this DateFormat. If the field specified by the FieldPosition is
+     * formatted, set the begin and end index of the formatted field in the
+     * FieldPosition.
+     * 
+     * @param object
+     *            the object to format, must be a Date or a Number. If the
+     *            object is a Number, a Date is constructed using the
+     *            <code>longValue()</code> of the Number.
+     * @param buffer
+     *            the StringBuffer
+     * @param field
+     *            the FieldPosition
+     * @return the StringBuffer parameter <code>buffer</code>
+     * 
+     * @exception IllegalArgumentException
+     *                when the object is not a Date or a Number
+     */
+    @Override
+    public final StringBuffer format(Object object, StringBuffer buffer,
+            FieldPosition field) {
+        if (object instanceof Date) {
             return format((Date) object, buffer, field);
         }
-		if (object instanceof Number) {
+        if (object instanceof Number) {
             return format(new Date(((Number) object).longValue()), buffer,
-					field);
+                    field);
         }
-		throw new IllegalArgumentException();
-	}
+        throw new IllegalArgumentException();
+    }
 
-	/**
-	 * Formats the specified Date using the rules of this DateFormat.
-	 * 
-	 * @param date
-	 *            the Date to format
-	 * @return the formatted String
-	 */
-	public final String format(Date date) {
-		return format(date, new StringBuffer(), new FieldPosition(0))
-				.toString();
-	}
-
-	/**
-	 * Formats the specified Date into the specified StringBuffer using the
-	 * rules of this DateFormat. If the field specified by the FieldPosition is
-	 * formatted, set the begin and end index of the formatted field in the
-	 * FieldPosition.
-	 * 
-	 * @param date
-	 *            the Date to format
-	 * @param buffer
-	 *            the StringBuffer
-	 * @param field
-	 *            the FieldPosition
-	 * @return the StringBuffer parameter <code>buffer</code>
-	 */
-	public abstract StringBuffer format(Date date, StringBuffer buffer,
-			FieldPosition field);
-
-	/**
-	 * Gets the list of installed Locales which support DateFormat.
-	 * 
-	 * @return an array of Locale
-	 */
-	public static Locale[] getAvailableLocales() {
-		return Locale.getAvailableLocales();
-	}
-
-	/**
-	 * Answers the Calendar used by this DateFormat.
-	 * 
-	 * @return a Calendar
-	 */
-	public Calendar getCalendar() {
-		return calendar;
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates in the
-	 * DEFAULT style for the default Locale.
-	 * 
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateInstance() {
-		return getDateInstance(DEFAULT);
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates in the
-	 * specified style for the default Locale.
-	 * 
-	 * @param style
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateInstance(int style) {
-		checkDateStyle(style);
-		return getDateInstance(style, Locale.getDefault());
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates in the
-	 * specified style for the specified Locale.
-	 * 
-	 * @param style
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @param locale
-	 *            the Locale
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateInstance(int style, Locale locale) {
-		checkDateStyle(style);
-		ResourceBundle bundle = getBundle(locale);
-		String pattern = bundle.getString("Date_" + getStyleName(style)); //$NON-NLS-1$
-		return new SimpleDateFormat(pattern, locale);
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates and times
-	 * in the DEFAULT style for the default Locale.
-	 * 
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateTimeInstance() {
-		return getDateTimeInstance(DEFAULT, DEFAULT);
-	}
-
-	/**
-	 * Answers a <code>DateFormat</code> instance for the formatting and
-	 * parsing of both dates and times in the manner appropriate to the default
-	 * Locale.
-	 * 
-	 * @param dateStyle
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @param timeStyle
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateTimeInstance(int dateStyle,
-			int timeStyle) {
-		checkTimeStyle(timeStyle);
-		checkDateStyle(dateStyle);
-		return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates and times
-	 * in the specified styles for the specified Locale.
-	 * 
-	 * @param dateStyle
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @param timeStyle
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @param locale
-	 *            the Locale
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getDateTimeInstance(int dateStyle,
-			int timeStyle, Locale locale) {
-		checkTimeStyle(timeStyle);
-		checkDateStyle(dateStyle);
-		ResourceBundle bundle = getBundle(locale);
-		String pattern = bundle.getString("Date_" + getStyleName(dateStyle)) //$NON-NLS-1$
-				+ " " + bundle.getString("Time_" + getStyleName(timeStyle)); //$NON-NLS-1$ //$NON-NLS-2$
-		return new SimpleDateFormat(pattern, locale);
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing dates and times
-	 * in the SHORT style for the default Locale.
-	 * 
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getInstance() {
-		return getDateTimeInstance(SHORT, SHORT);
-	}
-
-	/**
-	 * Answers the NumberFormat used by this DateFormat.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public NumberFormat getNumberFormat() {
-		return numberFormat;
-	}
-
-	static String getStyleName(int style) {
-		String styleName;
-		switch (style) {
-		case SHORT:
-			styleName = "SHORT"; //$NON-NLS-1$
-			break;
-		case MEDIUM:
-			styleName = "MEDIUM"; //$NON-NLS-1$
-			break;
-		case LONG:
-			styleName = "LONG"; //$NON-NLS-1$
-			break;
-		case FULL:
-			styleName = "FULL"; //$NON-NLS-1$
-			break;
-		default:
-			styleName = ""; //$NON-NLS-1$
-		}
-		return styleName;
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing times in the
-	 * DEFAULT style for the default Locale.
-	 * 
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getTimeInstance() {
-		return getTimeInstance(DEFAULT);
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing times in the
-	 * specified style for the default Locale.
-	 * 
-	 * @param style
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getTimeInstance(int style) {
-		checkTimeStyle(style);
-		return getTimeInstance(style, Locale.getDefault());
-	}
-
-	/**
-	 * Answers a DateFormat instance for formatting and parsing times in the
-	 * specified style for the specified Locale.
-	 * 
-	 * @param style
-	 *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
-	 * @param locale
-	 *            the Locale
-	 * @return a DateFormat
-	 */
-	public final static DateFormat getTimeInstance(int style, Locale locale) {
-		checkTimeStyle(style);
-		ResourceBundle bundle = getBundle(locale);
-		String pattern = bundle.getString("Time_" + getStyleName(style)); //$NON-NLS-1$
-		return new SimpleDateFormat(pattern, locale);
-	}
-
-	/**
-	 * Answers the TimeZone of the Calendar used by this DateFormat.
-	 * 
-	 * @return a TimeZone
-	 */
-	public TimeZone getTimeZone() {
-		return calendar.getTimeZone();
-	}
-
-	/**
-	 * Answers an integer hash code for the receiver. Objects which are equal
-	 * answer the same value for this method.
-	 * 
-	 * @return the receiver's hash
-	 * 
-	 * @see #equals
-	 */
-	public int hashCode() {
-		return calendar.getFirstDayOfWeek()
-				+ calendar.getMinimalDaysInFirstWeek()
-				+ calendar.getTimeZone().hashCode()
-				+ (calendar.isLenient() ? 1231 : 1237)
-				+ numberFormat.hashCode();
-	}
-
-	/**
-	 * Answers if the Calendar used by this DateFormat is lenient.
-	 * 
-	 * @return true when the Calendar is lenient, false otherwise
-	 */
-	public boolean isLenient() {
-		return calendar.isLenient();
-	}
-
-	/**
-	 * Parse a Date from the specified String using the rules of this
-	 * DateFormat.
-	 * 
-	 * @param string
-	 *            the String to parse
-	 * @return the Date resulting from the parse
-	 * 
-	 * @exception ParseException
-	 *                when an error occurs during parsing
-	 */
-	public Date parse(String string) throws ParseException {
-		ParsePosition position = new ParsePosition(0);
-		Date date = parse(string, position);
-		if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
+    /**
+     * Formats the specified Date using the rules of this DateFormat.
+     * 
+     * @param date
+     *            the Date to format
+     * @return the formatted String
+     */
+    public final String format(Date date) {
+        return format(date, new StringBuffer(), new FieldPosition(0))
+                .toString();
+    }
+
+    /**
+     * Formats the specified Date into the specified StringBuffer using the
+     * rules of this DateFormat. If the field specified by the FieldPosition is
+     * formatted, set the begin and end index of the formatted field in the
+     * FieldPosition.
+     * 
+     * @param date
+     *            the Date to format
+     * @param buffer
+     *            the StringBuffer
+     * @param field
+     *            the FieldPosition
+     * @return the StringBuffer parameter <code>buffer</code>
+     */
+    public abstract StringBuffer format(Date date, StringBuffer buffer,
+            FieldPosition field);
+
+    /**
+     * Gets the list of installed Locales which support DateFormat.
+     * 
+     * @return an array of Locale
+     */
+    public static Locale[] getAvailableLocales() {
+        return Locale.getAvailableLocales();
+    }
+
+    /**
+     * Answers the Calendar used by this DateFormat.
+     * 
+     * @return a Calendar
+     */
+    public Calendar getCalendar() {
+        return calendar;
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates in the
+     * DEFAULT style for the default Locale.
+     * 
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateInstance() {
+        return getDateInstance(DEFAULT);
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates in the
+     * specified style for the default Locale.
+     * 
+     * @param style
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateInstance(int style) {
+        checkDateStyle(style);
+        return getDateInstance(style, Locale.getDefault());
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates in the
+     * specified style for the specified Locale.
+     * 
+     * @param style
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @param locale
+     *            the Locale
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateInstance(int style, Locale locale) {
+        checkDateStyle(style);
+        ResourceBundle bundle = getBundle(locale);
+        String pattern = bundle.getString("Date_" + getStyleName(style)); //$NON-NLS-1$
+        return new SimpleDateFormat(pattern, locale);
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates and times
+     * in the DEFAULT style for the default Locale.
+     * 
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateTimeInstance() {
+        return getDateTimeInstance(DEFAULT, DEFAULT);
+    }
+
+    /**
+     * Answers a <code>DateFormat</code> instance for the formatting and
+     * parsing of both dates and times in the manner appropriate to the default
+     * Locale.
+     * 
+     * @param dateStyle
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @param timeStyle
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateTimeInstance(int dateStyle,
+            int timeStyle) {
+        checkTimeStyle(timeStyle);
+        checkDateStyle(dateStyle);
+        return getDateTimeInstance(dateStyle, timeStyle, Locale.getDefault());
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates and times
+     * in the specified styles for the specified Locale.
+     * 
+     * @param dateStyle
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @param timeStyle
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @param locale
+     *            the Locale
+     * @return a DateFormat
+     */
+    public final static DateFormat getDateTimeInstance(int dateStyle,
+            int timeStyle, Locale locale) {
+        checkTimeStyle(timeStyle);
+        checkDateStyle(dateStyle);
+        ResourceBundle bundle = getBundle(locale);
+        String pattern = bundle.getString("Date_" + getStyleName(dateStyle)) //$NON-NLS-1$
+                + " " + bundle.getString("Time_" + getStyleName(timeStyle)); //$NON-NLS-1$ //$NON-NLS-2$
+        return new SimpleDateFormat(pattern, locale);
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing dates and times
+     * in the SHORT style for the default Locale.
+     * 
+     * @return a DateFormat
+     */
+    public final static DateFormat getInstance() {
+        return getDateTimeInstance(SHORT, SHORT);
+    }
+
+    /**
+     * Answers the NumberFormat used by this DateFormat.
+     * 
+     * @return a NumberFormat
+     */
+    public NumberFormat getNumberFormat() {
+        return numberFormat;
+    }
+
+    static String getStyleName(int style) {
+        String styleName;
+        switch (style) {
+            case SHORT:
+                styleName = "SHORT"; //$NON-NLS-1$
+                break;
+            case MEDIUM:
+                styleName = "MEDIUM"; //$NON-NLS-1$
+                break;
+            case LONG:
+                styleName = "LONG"; //$NON-NLS-1$
+                break;
+            case FULL:
+                styleName = "FULL"; //$NON-NLS-1$
+                break;
+            default:
+                styleName = ""; //$NON-NLS-1$
+        }
+        return styleName;
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing times in the
+     * DEFAULT style for the default Locale.
+     * 
+     * @return a DateFormat
+     */
+    public final static DateFormat getTimeInstance() {
+        return getTimeInstance(DEFAULT);
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing times in the
+     * specified style for the default Locale.
+     * 
+     * @param style
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @return a DateFormat
+     */
+    public final static DateFormat getTimeInstance(int style) {
+        checkTimeStyle(style);
+        return getTimeInstance(style, Locale.getDefault());
+    }
+
+    /**
+     * Answers a DateFormat instance for formatting and parsing times in the
+     * specified style for the specified Locale.
+     * 
+     * @param style
+     *            one of SHORT, MEDIUM, LONG, FULL, or DEFAULT
+     * @param locale
+     *            the Locale
+     * @return a DateFormat
+     */
+    public final static DateFormat getTimeInstance(int style, Locale locale) {
+        checkTimeStyle(style);
+        ResourceBundle bundle = getBundle(locale);
+        String pattern = bundle.getString("Time_" + getStyleName(style)); //$NON-NLS-1$
+        return new SimpleDateFormat(pattern, locale);
+    }
+
+    /**
+     * Answers the TimeZone of the Calendar used by this DateFormat.
+     * 
+     * @return a TimeZone
+     */
+    public TimeZone getTimeZone() {
+        return calendar.getTimeZone();
+    }
+
+    /**
+     * Answers an integer hash code for the receiver. Objects which are equal
+     * answer the same value for this method.
+     * 
+     * @return the receiver's hash
+     * 
+     * @see #equals
+     */
+    @Override
+    public int hashCode() {
+        return calendar.getFirstDayOfWeek()
+                + calendar.getMinimalDaysInFirstWeek()
+                + calendar.getTimeZone().hashCode()
+                + (calendar.isLenient() ? 1231 : 1237)
+                + numberFormat.hashCode();
+    }
+
+    /**
+     * Answers if the Calendar used by this DateFormat is lenient.
+     * 
+     * @return true when the Calendar is lenient, false otherwise
+     */
+    public boolean isLenient() {
+        return calendar.isLenient();
+    }
+
+    /**
+     * Parse a Date from the specified String using the rules of this
+     * DateFormat.
+     * 
+     * @param string
+     *            the String to parse
+     * @return the Date resulting from the parse
+     * 
+     * @exception ParseException
+     *                when an error occurs during parsing
+     */
+    public Date parse(String string) throws ParseException {
+        ParsePosition position = new ParsePosition(0);
+        Date date = parse(string, position);
+        if (position.getErrorIndex() != -1 || position.getIndex() == 0) {
             throw new ParseException(null, position.getErrorIndex());
         }
-		return date;
-	}
+        return date;
+    }
 
-	/**
-	 * Parse a Date from the specified String starting at the index specified by
-	 * the ParsePosition. If the string is successfully parsed, the index of the
-	 * ParsePosition is updated to the index following the parsed text.
-	 * 
-	 * @param string
-	 *            the String to parse
-	 * @param position
-	 *            the ParsePosition, updated on return with the index following
-	 *            the parsed text, or on error the index is unchanged and the
-	 *            error index is set to the index where the error occurred
-	 * @return the Date resulting from the parse, or null if there is an error
-	 */
-	public abstract Date parse(String string, ParsePosition position);
-
-	/**
-	 * Parse a Date from the specified String starting at the index specified by
-	 * the ParsePosition. If the string is successfully parsed, the index of the
-	 * ParsePosition is updated to the index following the parsed text.
-	 * 
-	 * @param string
-	 *            the String to parse
-	 * @param position
-	 *            the ParsePosition, updated on return with the index following
-	 *            the parsed text, or on error the index is unchanged and the
-	 *            error index is set to the index where the error occurred
-	 * @return the Date resulting from the parse, or null if there is an error
-	 */
-	public Object parseObject(String string, ParsePosition position) {
-		return parse(string, position);
-	}
-
-	/**
-	 * Sets the Calendar used by this DateFormat.
-	 * 
-	 * @param cal
-	 *            the Calendar
-	 */
-	public void setCalendar(Calendar cal) {
-		calendar = cal;
-	}
-
-	/**
-	 * Sets if the Calendar used by this DateFormat is lenient.
-	 * 
-	 * @param value
-	 *            true to set the Calendar to be lenient, false otherwise
-	 */
-	public void setLenient(boolean value) {
-		calendar.setLenient(value);
-	}
-
-	/**
-	 * Sets the NumberFormat used by this DateFormat.
-	 * 
-	 * @param format
-	 *            the NumberFormat
-	 */
-	public void setNumberFormat(NumberFormat format) {
-		numberFormat = format;
-	}
-
-	/**
-	 * Sets the TimeZone of the Calendar used by this DateFormat.
-	 * 
-	 * @param timezone
-	 *            the TimeZone
-	 */
-	public void setTimeZone(TimeZone timezone) {
-		calendar.setTimeZone(timezone);
-	}
-
-	/**
-	 * The instances of this inner class are used as attribute keys and values
-	 * in AttributedCharacterIterator that
-	 * SimpleDateFormat.formatToCharacterIterator() method returns.
-	 * <p>
-	 * There is no public constructor to this class, the only instances are the
-	 * constants defined here.
-	 * <p>
-	 */
-	public static class Field extends Format.Field {
+    /**
+     * Parse a Date from the specified String starting at the index specified by
+     * the ParsePosition. If the string is successfully parsed, the index of the
+     * ParsePosition is updated to the index following the parsed text.
+     * 
+     * @param string
+     *            the String to parse
+     * @param position
+     *            the ParsePosition, updated on return with the index following
+     *            the parsed text, or on error the index is unchanged and the
+     *            error index is set to the index where the error occurred
+     * @return the Date resulting from the parse, or null if there is an error
+     */
+    public abstract Date parse(String string, ParsePosition position);
+
+    /**
+     * Parse a Date from the specified String starting at the index specified by
+     * the ParsePosition. If the string is successfully parsed, the index of the
+     * ParsePosition is updated to the index following the parsed text.
+     * 
+     * @param string
+     *            the String to parse
+     * @param position
+     *            the ParsePosition, updated on return with the index following
+     *            the parsed text, or on error the index is unchanged and the
+     *            error index is set to the index where the error occurred
+     * @return the Date resulting from the parse, or null if there is an error
+     */
+    @Override
+    public Object parseObject(String string, ParsePosition position) {
+        return parse(string, position);
+    }
+
+    /**
+     * Sets the Calendar used by this DateFormat.
+     * 
+     * @param cal
+     *            the Calendar
+     */
+    public void setCalendar(Calendar cal) {
+        calendar = cal;
+    }
+
+    /**
+     * Sets if the Calendar used by this DateFormat is lenient.
+     * 
+     * @param value
+     *            true to set the Calendar to be lenient, false otherwise
+     */
+    public void setLenient(boolean value) {
+        calendar.setLenient(value);
+    }
+
+    /**
+     * Sets the NumberFormat used by this DateFormat.
+     * 
+     * @param format
+     *            the NumberFormat
+     */
+    public void setNumberFormat(NumberFormat format) {
+        numberFormat = format;
+    }
+
+    /**
+     * Sets the TimeZone of the Calendar used by this DateFormat.
+     * 
+     * @param timezone
+     *            the TimeZone
+     */
+    public void setTimeZone(TimeZone timezone) {
+        calendar.setTimeZone(timezone);
+    }
+
+    /**
+     * The instances of this inner class are used as attribute keys and values
+     * in AttributedCharacterIterator that
+     * SimpleDateFormat.formatToCharacterIterator() method returns.
+     * <p>
+     * There is no public constructor to this class, the only instances are the
+     * constants defined here.
+     * <p>
+     */
+    public static class Field extends Format.Field {
 
         private static final long serialVersionUID = 7441350119349544720L;
-        
-		private static Hashtable<Integer, Field> table = new Hashtable<Integer, Field>();
 
-		public final static Field ERA = new Field("era", Calendar.ERA); //$NON-NLS-1$
+        private static Hashtable<Integer, Field> table = new Hashtable<Integer, Field>();
 
-		public final static Field YEAR = new Field("year", Calendar.YEAR); //$NON-NLS-1$
+        public final static Field ERA = new Field("era", Calendar.ERA); //$NON-NLS-1$
 
-		public final static Field MONTH = new Field("month", Calendar.MONTH); //$NON-NLS-1$
+        public final static Field YEAR = new Field("year", Calendar.YEAR); //$NON-NLS-1$
 
-		public final static Field HOUR_OF_DAY0 = new Field("hour of day", //$NON-NLS-1$
-				Calendar.HOUR_OF_DAY);
+        public final static Field MONTH = new Field("month", Calendar.MONTH); //$NON-NLS-1$
 
-		public final static Field HOUR_OF_DAY1 = new Field("hour of day 1", -1); //$NON-NLS-1$
+        public final static Field HOUR_OF_DAY0 = new Field("hour of day", //$NON-NLS-1$
+                Calendar.HOUR_OF_DAY);
 
-		public final static Field MINUTE = new Field("minute", Calendar.MINUTE); //$NON-NLS-1$
+        public final static Field HOUR_OF_DAY1 = new Field("hour of day 1", -1); //$NON-NLS-1$
 
-		public final static Field SECOND = new Field("second", Calendar.SECOND); //$NON-NLS-1$
+        public final static Field MINUTE = new Field("minute", Calendar.MINUTE); //$NON-NLS-1$
 
-		public final static Field MILLISECOND = new Field("millisecond", //$NON-NLS-1$
-				Calendar.MILLISECOND);
+        public final static Field SECOND = new Field("second", Calendar.SECOND); //$NON-NLS-1$
 
-		public final static Field DAY_OF_WEEK = new Field("day of week", //$NON-NLS-1$
-				Calendar.DAY_OF_WEEK);
+        public final static Field MILLISECOND = new Field("millisecond", //$NON-NLS-1$
+                Calendar.MILLISECOND);
 
-		public final static Field DAY_OF_MONTH = new Field("day of month", //$NON-NLS-1$
-				Calendar.DAY_OF_MONTH);
+        public final static Field DAY_OF_WEEK = new Field("day of week", //$NON-NLS-1$
+                Calendar.DAY_OF_WEEK);
 
-		public final static Field DAY_OF_YEAR = new Field("day of year", //$NON-NLS-1$
-				Calendar.DAY_OF_YEAR);
+        public final static Field DAY_OF_MONTH = new Field("day of month", //$NON-NLS-1$
+                Calendar.DAY_OF_MONTH);
 
-		public final static Field DAY_OF_WEEK_IN_MONTH = new Field(
-				"day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH); //$NON-NLS-1$
+        public final static Field DAY_OF_YEAR = new Field("day of year", //$NON-NLS-1$
+                Calendar.DAY_OF_YEAR);
 
-		public final static Field WEEK_OF_YEAR = new Field("week of year", //$NON-NLS-1$
-				Calendar.WEEK_OF_YEAR);
+        public final static Field DAY_OF_WEEK_IN_MONTH = new Field(
+                "day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH); //$NON-NLS-1$
 
-		public final static Field WEEK_OF_MONTH = new Field("week of month", //$NON-NLS-1$
-				Calendar.WEEK_OF_MONTH);
+        public final static Field WEEK_OF_YEAR = new Field("week of year", //$NON-NLS-1$
+                Calendar.WEEK_OF_YEAR);
 
-		public final static Field AM_PM = new Field("am pm", Calendar.AM_PM); //$NON-NLS-1$
+        public final static Field WEEK_OF_MONTH = new Field("week of month", //$NON-NLS-1$
+                Calendar.WEEK_OF_MONTH);
 
-		public final static Field HOUR0 = new Field("hour", Calendar.HOUR); //$NON-NLS-1$
+        public final static Field AM_PM = new Field("am pm", Calendar.AM_PM); //$NON-NLS-1$
 
-		public final static Field HOUR1 = new Field("hour 1", -1); //$NON-NLS-1$
+        public final static Field HOUR0 = new Field("hour", Calendar.HOUR); //$NON-NLS-1$
 
-		public final static Field TIME_ZONE = new Field("time zone", -1); //$NON-NLS-1$
+        public final static Field HOUR1 = new Field("hour 1", -1); //$NON-NLS-1$
 
-		/**
-		 * The Calendar field that this Field represents.
-		 */
-		private int calendarField = -1;
+        public final static Field TIME_ZONE = new Field("time zone", -1); //$NON-NLS-1$
 
-		/**
-		 * Constructs a new instance of DateFormat.Field with the given
-		 * fieldName and calendar field.
-		 */
-		protected Field(String fieldName, int calendarField) {
-			super(fieldName);
-			this.calendarField = calendarField;
-			if (calendarField != -1
-					&& table.get(new Integer(calendarField)) == null) {
+        /**
+         * The Calendar field that this Field represents.
+         */
+        private int calendarField = -1;
+
+        /**
+         * Constructs a new instance of DateFormat.Field with the given
+         * fieldName and calendar field.
+         */
+        protected Field(String fieldName, int calendarField) {
+            super(fieldName);
+            this.calendarField = calendarField;
+            if (calendarField != -1
+                    && table.get(new Integer(calendarField)) == null) {
                 table.put(new Integer(calendarField), this);
             }
-		}
+        }
 
-		/**
-		 * Answers the Calendar field this Field represents
-		 * 
-		 * @return int calendar field
-		 */
-		public int getCalendarField() {
-			return calendarField;
-		}
-
-		/**
-		 * Answers the DateFormat.Field instance for the given calendar field
-		 * 
-		 * @param calendarField
-		 *            a calendar field constant
-		 * @return null if there is no Field for this calendar field
-		 */
-		public static Field ofCalendarField(int calendarField) {
-			if (calendarField < 0 || calendarField >= Calendar.FIELD_COUNT) {
+        /**
+         * Answers the Calendar field this Field represents
+         * 
+         * @return int calendar field
+         */
+        public int getCalendarField() {
+            return calendarField;
+        }
+
+        /**
+         * Answers the DateFormat.Field instance for the given calendar field
+         * 
+         * @param calendarField
+         *            a calendar field constant
+         * @return null if there is no Field for this calendar field
+         */
+        public static Field ofCalendarField(int calendarField) {
+            if (calendarField < 0 || calendarField >= Calendar.FIELD_COUNT) {
                 throw new IllegalArgumentException();
             }
 
-			return table.get(new Integer(calendarField));
-		}
+            return table.get(new Integer(calendarField));
+        }
 
-		/**
-		 * Serialization method resolve instances to the constant
-		 * DateFormat.Field values
-		 */
-		protected Object readResolve() throws InvalidObjectException {
-			if (calendarField != -1) {
-				try {
-					Field result = ofCalendarField(calendarField);
-					if (result != null && this.equals(result)) {
+        /**
+         * Serialization method resolve instances to the constant
+         * DateFormat.Field values
+         */
+        @Override
+        protected Object readResolve() throws InvalidObjectException {
+            if (calendarField != -1) {
+                try {
+                    Field result = ofCalendarField(calendarField);
+                    if (result != null && this.equals(result)) {
                         return result;
                     }
-				} catch (IllegalArgumentException e) {
+                } catch (IllegalArgumentException e) {
                     // text.02=Unknown attribute
-					throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
-				}
-			} else {
-				if (this.equals(TIME_ZONE)) {
+                    throw new InvalidObjectException(Messages
+                            .getString("text.02")); //$NON-NLS-1$
+                }
+            } else {
+                if (this.equals(TIME_ZONE)) {
                     return TIME_ZONE;
                 }
-				if (this.equals(HOUR1)) {
+                if (this.equals(HOUR1)) {
                     return HOUR1;
                 }
-				if (this.equals(HOUR_OF_DAY1)) {
+                if (this.equals(HOUR_OF_DAY1)) {
                     return HOUR_OF_DAY1;
                 }
-			}
-			// text.02=Unknown attribute
-			throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
-		}
-	}
+            }
+            // text.02=Unknown attribute
+            throw new InvalidObjectException(Messages.getString("text.02")); //$NON-NLS-1$
+        }
+    }
 
-	private static void checkDateStyle(int style) {
-		if (!(style == SHORT || style == MEDIUM || style ==  LONG || style ==  FULL || style == DEFAULT))
+    private static void checkDateStyle(int style) {
+        if (!(style == SHORT || style == MEDIUM || style == LONG
+                || style == FULL || style == DEFAULT)) {
             // text.0E=Illegal date style: {0}
-			throw new IllegalArgumentException(Messages.getString("text.0E", style)); //$NON-NLS-1$
-	}
-	private static void checkTimeStyle(int style) {
-		if (!(style == SHORT || style == MEDIUM || style ==  LONG || style ==  FULL || style == DEFAULT))
+            throw new IllegalArgumentException(Messages.getString(
+                    "text.0E", style)); //$NON-NLS-1$
+        }
+    }
+
+    private static void checkTimeStyle(int style) {
+        if (!(style == SHORT || style == MEDIUM || style == LONG
+                || style == FULL || style == DEFAULT)) {
             // text.0F=Illegal time style: {0}
-			throw new IllegalArgumentException(Messages.getString("text.0F", style)); //$NON-NLS-1$
-	}
+            throw new IllegalArgumentException(Messages.getString(
+                    "text.0F", style)); //$NON-NLS-1$
+        }
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DateFormatSymbols.java Tue Oct 10 15:18:35 2006
@@ -17,7 +17,6 @@
 
 package java.text;
 
-
 import java.io.Serializable;
 import java.util.Arrays;
 import java.util.Locale;
@@ -29,330 +28,355 @@
  */
 public class DateFormatSymbols implements Serializable, Cloneable {
 
-	private static final long serialVersionUID = -5987973545549424702L;
+    private static final long serialVersionUID = -5987973545549424702L;
 
-	private String localPatternChars;
+    private String localPatternChars;
 
-	String[] ampms, eras, months, shortMonths, shortWeekdays, weekdays;
+    String[] ampms, eras, months, shortMonths, shortWeekdays, weekdays;
 
-	String[][] zoneStrings;
+    String[][] zoneStrings;
 
-	/**
-	 * Constructs a new DateFormatSymbols containing the symbols for the default
-	 * Locale.
-	 */
-	public DateFormatSymbols() {
-		this(Locale.getDefault());
-	}
-
-	/**
-	 * Constructs a new DateFormatSymbols containing the symbols for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 */
-	public DateFormatSymbols(Locale locale) {
-		ResourceBundle bundle = Format.getBundle(locale);
-		localPatternChars = bundle.getString("LocalPatternChars"); //$NON-NLS-1$
-		ampms = bundle.getStringArray("ampm"); //$NON-NLS-1$
-		eras = bundle.getStringArray("eras"); //$NON-NLS-1$
-		months = bundle.getStringArray("months"); //$NON-NLS-1$
-		shortMonths = bundle.getStringArray("shortMonths"); //$NON-NLS-1$
-		shortWeekdays = bundle.getStringArray("shortWeekdays"); //$NON-NLS-1$
-		weekdays = bundle.getStringArray("weekdays"); //$NON-NLS-1$
-		zoneStrings = (String[][]) bundle.getObject("timezones"); //$NON-NLS-1$
-	}
-
-	/**
-	 * Answers a new DateFormatSymbols with the same symbols as this
-	 * DateFormatSymbols.
-	 * 
-	 * @return a shallow copy of this DateFormatSymbols
-	 * 
-	 * @see java.lang.Cloneable
-	 */
-	public Object clone() {
-		try {
-			DateFormatSymbols symbols = (DateFormatSymbols) super.clone();
-			symbols.ampms = (String[]) ampms.clone();
-			symbols.eras = (String[]) eras.clone();
-			symbols.months = (String[]) months.clone();
-			symbols.shortMonths = (String[]) shortMonths.clone();
-			symbols.shortWeekdays = (String[]) shortWeekdays.clone();
-			symbols.weekdays = (String[]) weekdays.clone();
-			symbols.zoneStrings = new String[zoneStrings.length][];
-			for (int i = 0; i < zoneStrings.length; i++)
-				symbols.zoneStrings[i] = (String[]) zoneStrings[i].clone();
-			return symbols;
-		} catch (CloneNotSupportedException e) {
-			return null;
-		}
-	}
-
-	/**
-	 * Compares the specified object to this DateFormatSymbols and answer if
-	 * they are equal. The object must be an instance of DateFormatSymbols with
-	 * the same symbols.
-	 * 
-	 * @param object
-	 *            the object to compare with this object
-	 * @return true if the specified object is equal to this DateFormatSymbols,
-	 *         false otherwise
-	 * 
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object) {
-		if (this == object)
-			return true;
-		if (!(object instanceof DateFormatSymbols))
-			return false;
-		DateFormatSymbols obj = (DateFormatSymbols) object;
-		if (!localPatternChars.equals(obj.localPatternChars))
-			return false;
-		if (!Arrays.equals(ampms, obj.ampms))
-			return false;
-		if (!Arrays.equals(eras, obj.eras))
-			return false;
-		if (!Arrays.equals(months, obj.months))
-			return false;
-		if (!Arrays.equals(shortMonths, obj.shortMonths))
-			return false;
-		if (!Arrays.equals(shortWeekdays, obj.shortWeekdays))
-			return false;
-		if (!Arrays.equals(weekdays, obj.weekdays))
-			return false;
-		if (zoneStrings.length != obj.zoneStrings.length)
-			return false;
-		for (int i = 0; i < zoneStrings.length; i++) {
-			if (zoneStrings[i].length != obj.zoneStrings[i].length)
-				return false;
-			for (int j = 0; j < zoneStrings[i].length; j++)
-				if (zoneStrings[i][j] != obj.zoneStrings[i][j]
-						&& !(zoneStrings[i][j].equals(obj.zoneStrings[i][j])))
-					return false;
-		}
-		return true;
-	}
-
-	/**
-	 * Answers the array of Strings which represent AM and PM. Use the Calendar
-	 * constants Calendar.AM and Calendar.PM to index into the array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getAmPmStrings() {
-		return (String[]) ampms.clone();
-	}
-
-	/**
-	 * Answers the array of Strings which represent BC and AD. Use the Calendar
-	 * constants GregorianCalendar.BC and GregorianCalendar.AD to index into the
-	 * array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getEras() {
-		return (String[]) eras.clone();
-	}
-
-	/**
-	 * Answers the pattern characters used by SimpleDateFormat to specify date
-	 * and time fields.
-	 * 
-	 * @return a String containing the pattern characters
-	 */
-	public String getLocalPatternChars() {
-		return localPatternChars;
-	}
-
-	/**
-	 * Answers the array of Strings containing the full names of the months. Use
-	 * the Calendar constants Calendar.JANUARY, etc. to index into the array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getMonths() {
-		return (String[]) months.clone();
-	}
-
-	/**
-	 * Answers the array of Strings containing the abbreviated names of the
-	 * months. Use the Calendar constants Calendar.JANUARY, etc. to index into
-	 * the array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getShortMonths() {
-		return (String[]) shortMonths.clone();
-	}
-
-	/**
-	 * Answers the array of Strings containing the abbreviated names of the days
-	 * of the week. Use the Calendar constants Calendar.SUNDAY, etc. to index
-	 * into the array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getShortWeekdays() {
-		return (String[]) shortWeekdays.clone();
-	}
-
-	/**
-	 * Answers the array of Strings containing the full names of the days of the
-	 * week. Use the Calendar constants Calendar.SUNDAY, etc. to index into the
-	 * array.
-	 * 
-	 * @return an array of String
-	 */
-	public String[] getWeekdays() {
-		return (String[]) weekdays.clone();
-	}
-
-	/**
-	 * Answers the two-dimensional array of Strings containing the names of the
-	 * timezones. Each element in the array is an array of five Strings, the
-	 * first is a TimeZone ID, and second and third are the full and abbreviated
-	 * timezone names for standard time, and the fourth and fifth are the full
-	 * and abbreviated names for daylight time.
-	 * 
-	 * @return a two-dimensional array of String
-	 */
-	public String[][] getZoneStrings() {
-		String[][] clone = new String[zoneStrings.length][];
-		for (int i = zoneStrings.length; --i >= 0;)
-			clone[i] = (String[]) zoneStrings[i].clone();
-		return clone;
-	}
-
-	/**
-	 * Answers an integer hash code for the receiver. Objects which are equal
-	 * answer the same value for this method.
-	 * 
-	 * @return the receiver's hash
-	 * 
-	 * @see #equals
-	 */
-	public int hashCode() {
-		int hashCode;
-		hashCode = localPatternChars.hashCode();
-		for (int i = 0; i < ampms.length; i++)
-			hashCode += ampms[i].hashCode();
-		for (int i = 0; i < eras.length; i++)
-			hashCode += eras[i].hashCode();
-		for (int i = 0; i < months.length; i++)
-			hashCode += months[i].hashCode();
-		for (int i = 0; i < shortMonths.length; i++)
-			hashCode += shortMonths[i].hashCode();
-		for (int i = 0; i < shortWeekdays.length; i++)
-			hashCode += shortWeekdays[i].hashCode();
-		for (int i = 0; i < weekdays.length; i++)
-			hashCode += weekdays[i].hashCode();
-		for (int i = 0; i < zoneStrings.length; i++) {
-			for (int j = 0; j < zoneStrings[i].length; j++)
-				hashCode += zoneStrings[i][j].hashCode();
-		}
-		return hashCode;
-	}
-
-	/**
-	 * Sets the array of Strings which represent AM and PM. Use the Calendar
-	 * constants Calendar.AM and Calendar.PM to index into the array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setAmPmStrings(String[] data) {
-		ampms = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the array of Strings which represent BC and AD. Use the Calendar
-	 * constants GregorianCalendar.BC and GregorianCalendar.AD to index into the
-	 * array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setEras(String[] data) {
-		eras = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the pattern characters used by SimpleDateFormat to specify date and
-	 * time fields.
-	 * 
-	 * @param data
-	 *            the String containing the pattern characters
-	 *
-	 * @exception NullPointerException
-	 *                when the data is null
-	 */
-	public void setLocalPatternChars(String data) {
-		if (data==null) {
-			throw new NullPointerException();
-		}
-		localPatternChars = data;
-	}
-
-	/**
-	 * Sets the array of Strings containing the full names of the months. Use
-	 * the Calendar constants Calendar.JANUARY, etc. to index into the array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setMonths(String[] data) {
-		months = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the array of Strings containing the abbreviated names of the months.
-	 * Use the Calendar constants Calendar.JANUARY, etc. to index into the
-	 * array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setShortMonths(String[] data) {
-		shortMonths = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the array of Strings containing the abbreviated names of the days of
-	 * the week. Use the Calendar constants Calendar.SUNDAY, etc. to index into
-	 * the array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setShortWeekdays(String[] data) {
-		shortWeekdays = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the array of Strings containing the full names of the days of the
-	 * week. Use the Calendar constants Calendar.SUNDAY, etc. to index into the
-	 * array.
-	 * 
-	 * @param data
-	 *            the array of Strings
-	 */
-	public void setWeekdays(String[] data) {
-		weekdays = (String[]) data.clone();
-	}
-
-	/**
-	 * Sets the two-dimensional array of Strings containing the names of the
-	 * timezones. Each element in the array is an array of five Strings, the
-	 * first is a TimeZone ID, and second and third are the full and abbreviated
-	 * timezone names for standard time, and the fourth and fifth are the full
-	 * and abbreviated names for daylight time.
-	 * 
-	 * @param data
-	 *            the two-dimensional array of Strings
-	 */
-	public void setZoneStrings(String[][] data) {
-		zoneStrings = (String[][]) data.clone();
-	}
+    /**
+     * Constructs a new DateFormatSymbols containing the symbols for the default
+     * Locale.
+     */
+    public DateFormatSymbols() {
+        this(Locale.getDefault());
+    }
+
+    /**
+     * Constructs a new DateFormatSymbols containing the symbols for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     */
+    public DateFormatSymbols(Locale locale) {
+        ResourceBundle bundle = Format.getBundle(locale);
+        localPatternChars = bundle.getString("LocalPatternChars"); //$NON-NLS-1$
+        ampms = bundle.getStringArray("ampm"); //$NON-NLS-1$
+        eras = bundle.getStringArray("eras"); //$NON-NLS-1$
+        months = bundle.getStringArray("months"); //$NON-NLS-1$
+        shortMonths = bundle.getStringArray("shortMonths"); //$NON-NLS-1$
+        shortWeekdays = bundle.getStringArray("shortWeekdays"); //$NON-NLS-1$
+        weekdays = bundle.getStringArray("weekdays"); //$NON-NLS-1$
+        zoneStrings = (String[][]) bundle.getObject("timezones"); //$NON-NLS-1$
+    }
+
+    /**
+     * Answers a new DateFormatSymbols with the same symbols as this
+     * DateFormatSymbols.
+     * 
+     * @return a shallow copy of this DateFormatSymbols
+     * 
+     * @see java.lang.Cloneable
+     */
+    @Override
+    public Object clone() {
+        try {
+            DateFormatSymbols symbols = (DateFormatSymbols) super.clone();
+            symbols.ampms = ampms.clone();
+            symbols.eras = eras.clone();
+            symbols.months = months.clone();
+            symbols.shortMonths = shortMonths.clone();
+            symbols.shortWeekdays = shortWeekdays.clone();
+            symbols.weekdays = weekdays.clone();
+            symbols.zoneStrings = new String[zoneStrings.length][];
+            for (int i = 0; i < zoneStrings.length; i++) {
+                symbols.zoneStrings[i] = zoneStrings[i].clone();
+            }
+            return symbols;
+        } catch (CloneNotSupportedException e) {
+            return null;
+        }
+    }
+
+    /**
+     * Compares the specified object to this DateFormatSymbols and answer if
+     * they are equal. The object must be an instance of DateFormatSymbols with
+     * the same symbols.
+     * 
+     * @param object
+     *            the object to compare with this object
+     * @return true if the specified object is equal to this DateFormatSymbols,
+     *         false otherwise
+     * 
+     * @see #hashCode
+     */
+    @Override
+    public boolean equals(Object object) {
+        if (this == object) {
+            return true;
+        }
+        if (!(object instanceof DateFormatSymbols)) {
+            return false;
+        }
+        DateFormatSymbols obj = (DateFormatSymbols) object;
+        if (!localPatternChars.equals(obj.localPatternChars)) {
+            return false;
+        }
+        if (!Arrays.equals(ampms, obj.ampms)) {
+            return false;
+        }
+        if (!Arrays.equals(eras, obj.eras)) {
+            return false;
+        }
+        if (!Arrays.equals(months, obj.months)) {
+            return false;
+        }
+        if (!Arrays.equals(shortMonths, obj.shortMonths)) {
+            return false;
+        }
+        if (!Arrays.equals(shortWeekdays, obj.shortWeekdays)) {
+            return false;
+        }
+        if (!Arrays.equals(weekdays, obj.weekdays)) {
+            return false;
+        }
+        if (zoneStrings.length != obj.zoneStrings.length) {
+            return false;
+        }
+        for (String[] element : zoneStrings) {
+            if (element.length != element.length) {
+                return false;
+            }
+            for (int j = 0; j < element.length; j++) {
+                if (element[j] != element[j]
+                        && !(element[j].equals(element[j]))) {
+                    return false;
+                }
+            }
+        }
+        return true;
+    }
+
+    /**
+     * Answers the array of Strings which represent AM and PM. Use the Calendar
+     * constants Calendar.AM and Calendar.PM to index into the array.
+     * 
+     * @return an array of String
+     */
+    public String[] getAmPmStrings() {
+        return ampms.clone();
+    }
+
+    /**
+     * Answers the array of Strings which represent BC and AD. Use the Calendar
+     * constants GregorianCalendar.BC and GregorianCalendar.AD to index into the
+     * array.
+     * 
+     * @return an array of String
+     */
+    public String[] getEras() {
+        return eras.clone();
+    }
+
+    /**
+     * Answers the pattern characters used by SimpleDateFormat to specify date
+     * and time fields.
+     * 
+     * @return a String containing the pattern characters
+     */
+    public String getLocalPatternChars() {
+        return localPatternChars;
+    }
+
+    /**
+     * Answers the array of Strings containing the full names of the months. Use
+     * the Calendar constants Calendar.JANUARY, etc. to index into the array.
+     * 
+     * @return an array of String
+     */
+    public String[] getMonths() {
+        return months.clone();
+    }
+
+    /**
+     * Answers the array of Strings containing the abbreviated names of the
+     * months. Use the Calendar constants Calendar.JANUARY, etc. to index into
+     * the array.
+     * 
+     * @return an array of String
+     */
+    public String[] getShortMonths() {
+        return shortMonths.clone();
+    }
+
+    /**
+     * Answers the array of Strings containing the abbreviated names of the days
+     * of the week. Use the Calendar constants Calendar.SUNDAY, etc. to index
+     * into the array.
+     * 
+     * @return an array of String
+     */
+    public String[] getShortWeekdays() {
+        return shortWeekdays.clone();
+    }
+
+    /**
+     * Answers the array of Strings containing the full names of the days of the
+     * week. Use the Calendar constants Calendar.SUNDAY, etc. to index into the
+     * array.
+     * 
+     * @return an array of String
+     */
+    public String[] getWeekdays() {
+        return weekdays.clone();
+    }
+
+    /**
+     * Answers the two-dimensional array of Strings containing the names of the
+     * timezones. Each element in the array is an array of five Strings, the
+     * first is a TimeZone ID, and second and third are the full and abbreviated
+     * timezone names for standard time, and the fourth and fifth are the full
+     * and abbreviated names for daylight time.
+     * 
+     * @return a two-dimensional array of String
+     */
+    public String[][] getZoneStrings() {
+        String[][] clone = new String[zoneStrings.length][];
+        for (int i = zoneStrings.length; --i >= 0;) {
+            clone[i] = zoneStrings[i].clone();
+        }
+        return clone;
+    }
+
+    /**
+     * Answers an integer hash code for the receiver. Objects which are equal
+     * answer the same value for this method.
+     * 
+     * @return the receiver's hash
+     * 
+     * @see #equals
+     */
+    @Override
+    public int hashCode() {
+        int hashCode;
+        hashCode = localPatternChars.hashCode();
+        for (String element : ampms) {
+            hashCode += element.hashCode();
+        }
+        for (String element : eras) {
+            hashCode += element.hashCode();
+        }
+        for (String element : months) {
+            hashCode += element.hashCode();
+        }
+        for (String element : shortMonths) {
+            hashCode += element.hashCode();
+        }
+        for (String element : shortWeekdays) {
+            hashCode += element.hashCode();
+        }
+        for (String element : weekdays) {
+            hashCode += element.hashCode();
+        }
+        for (String[] element : zoneStrings) {
+            for (int j = 0; j < element.length; j++) {
+                hashCode += element[j].hashCode();
+            }
+        }
+        return hashCode;
+    }
+
+    /**
+     * Sets the array of Strings which represent AM and PM. Use the Calendar
+     * constants Calendar.AM and Calendar.PM to index into the array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setAmPmStrings(String[] data) {
+        ampms = data.clone();
+    }
+
+    /**
+     * Sets the array of Strings which represent BC and AD. Use the Calendar
+     * constants GregorianCalendar.BC and GregorianCalendar.AD to index into the
+     * array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setEras(String[] data) {
+        eras = data.clone();
+    }
+
+    /**
+     * Sets the pattern characters used by SimpleDateFormat to specify date and
+     * time fields.
+     * 
+     * @param data
+     *            the String containing the pattern characters
+     * 
+     * @exception NullPointerException
+     *                when the data is null
+     */
+    public void setLocalPatternChars(String data) {
+        if (data == null) {
+            throw new NullPointerException();
+        }
+        localPatternChars = data;
+    }
+
+    /**
+     * Sets the array of Strings containing the full names of the months. Use
+     * the Calendar constants Calendar.JANUARY, etc. to index into the array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setMonths(String[] data) {
+        months = data.clone();
+    }
+
+    /**
+     * Sets the array of Strings containing the abbreviated names of the months.
+     * Use the Calendar constants Calendar.JANUARY, etc. to index into the
+     * array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setShortMonths(String[] data) {
+        shortMonths = data.clone();
+    }
+
+    /**
+     * Sets the array of Strings containing the abbreviated names of the days of
+     * the week. Use the Calendar constants Calendar.SUNDAY, etc. to index into
+     * the array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setShortWeekdays(String[] data) {
+        shortWeekdays = data.clone();
+    }
+
+    /**
+     * Sets the array of Strings containing the full names of the days of the
+     * week. Use the Calendar constants Calendar.SUNDAY, etc. to index into the
+     * array.
+     * 
+     * @param data
+     *            the array of Strings
+     */
+    public void setWeekdays(String[] data) {
+        weekdays = data.clone();
+    }
+
+    /**
+     * Sets the two-dimensional array of Strings containing the names of the
+     * timezones. Each element in the array is an array of five Strings, the
+     * first is a TimeZone ID, and second and third are the full and abbreviated
+     * timezone names for standard time, and the fourth and fifth are the full
+     * and abbreviated names for daylight time.
+     * 
+     * @param data
+     *            the two-dimensional array of Strings
+     */
+    public void setZoneStrings(String[][] data) {
+        zoneStrings = data.clone();
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/DecimalFormat.java Tue Oct 10 15:18:35 2006
@@ -87,7 +87,7 @@
      *                when the pattern cannot be parsed
      */
     public DecimalFormat(String pattern, DecimalFormatSymbols value) {
-        symbols = (DecimalFormatSymbols)value.clone();
+        symbols = (DecimalFormatSymbols) value.clone();
         Locale locale = (Locale) this.getInternalField("locale", symbols); //$NON-NLS-1$
         icuSymbols = new com.ibm.icu.text.DecimalFormatSymbols(locale);
         copySymbols(icuSymbols, symbols);
@@ -137,6 +137,7 @@
      * 
      * @see java.lang.Cloneable
      */
+    @Override
     public Object clone() {
         DecimalFormat clone = (DecimalFormat) super.clone();
         clone.dform = (com.ibm.icu.text.DecimalFormat) dform.clone();
@@ -156,6 +157,7 @@
      * 
      * @see #hashCode
      */
+    @Override
     public boolean equals(Object object) {
         if (this == object) {
             return true;
@@ -183,6 +185,7 @@
      * @exception IllegalArgumentException
      *                when the object cannot be formatted by this Format
      */
+    @Override
     public AttributedCharacterIterator formatToCharacterIterator(Object object) {
         if (object == null) {
             throw new NullPointerException();
@@ -204,6 +207,7 @@
      *            the FieldPosition
      * @return the StringBuffer parameter <code>buffer</code>
      */
+    @Override
     public StringBuffer format(double value, StringBuffer buffer,
             FieldPosition position) {
         return dform.format(value, buffer, position);
@@ -223,6 +227,7 @@
      *            the FieldPosition
      * @return the StringBuffer parameter <code>buffer</code>
      */
+    @Override
     public StringBuffer format(long value, StringBuffer buffer,
             FieldPosition position) {
         return dform.format(value, buffer, position);
@@ -244,6 +249,7 @@
      * @throws IllegalArgumentException
      *             if the given number is not instance of <code>Number</code>
      */
+    @Override
     public final StringBuffer format(Object number, StringBuffer toAppendTo,
             FieldPosition pos) {
         if (!(number instanceof Number)) {
@@ -254,9 +260,8 @@
         }
         if (number instanceof BigInteger || number instanceof BigDecimal) {
             return dform.format(number, toAppendTo, pos);
-        } else {
-            return super.format(number, toAppendTo, pos);
         }
+        return super.format(number, toAppendTo, pos);
     }
 
     /**
@@ -274,6 +279,7 @@
      * @return currency of DecimalFormatSymbols used by this decimal format
      * @see DecimalFormatSymbols#getCurrency()
      */
+    @Override
     public Currency getCurrency() {
         if (dform.getCurrency() == null) {
             return null;
@@ -344,6 +350,7 @@
      * 
      * @see #equals
      */
+    @Override
     public int hashCode() {
         return dform.hashCode();
     }
@@ -384,6 +391,7 @@
      *            If set to true, all the resulting number will be of type
      *            java.lang.Integer except some special cases.
      */
+    @Override
     public void setParseIntegerOnly(boolean value) {
         dform.setParseIntegerOnly(value);
     }
@@ -395,6 +403,7 @@
      * @return true if this <code>DecimalFormat</code>'s all resulting number
      *         will be of type <code>java.lang.Integer</code>
      */
+    @Override
     public boolean isParseIntegerOnly() {
         return dform.isParseIntegerOnly();
     }
@@ -417,6 +426,7 @@
      *         error. The result will be a Long if the parsed number is an
      *         integer in the range of a long, otherwise the result is a Double.
      */
+    @Override
     public Number parse(String string, ParsePosition position) {
         Number number = dform.parse(string, position);
         if (null == number) {
@@ -438,19 +448,16 @@
                 return new BigDecimal(number.toString());
             }
             return number;
-        } else {
-            if ((number instanceof com.ibm.icu.math.BigDecimal)
-                    || (number instanceof BigInteger)) {
-                return new Double(number.doubleValue());
-            }
-
-            if (this.isParseIntegerOnly()
-                    && number.equals(NEGATIVE_ZERO_DOUBLE)) {
-                return new Long(0);
-            }
-            return number;
+        }
+        if ((number instanceof com.ibm.icu.math.BigDecimal)
+                || (number instanceof BigInteger)) {
+            return new Double(number.doubleValue());
+        }
 
+        if (this.isParseIntegerOnly() && number.equals(NEGATIVE_ZERO_DOUBLE)) {
+            return new Long(0);
         }
+        return number;
 
     }
 
@@ -461,7 +468,7 @@
      *            the DecimalFormatSymbols
      */
     public void setDecimalFormatSymbols(DecimalFormatSymbols value) {
-        if (value != null){
+        if (value != null) {
             symbols = (DecimalFormatSymbols) value.clone();
             icuSymbols = dform.getDecimalFormatSymbols();
             copySymbols(icuSymbols, symbols);
@@ -476,6 +483,7 @@
      * @param currency
      * @see DecimalFormatSymbols#setCurrency(Currency)
      */
+    @Override
     public void setCurrency(Currency currency) {
         dform.setCurrency(com.ibm.icu.util.Currency.getInstance(currency
                 .getCurrencyCode()));
@@ -512,6 +520,7 @@
      *            true if uses grouping,false otherwise.
      * 
      */
+    @Override
     public void setGroupingUsed(boolean value) {
         dform.setGroupingUsed(value);
     }
@@ -521,6 +530,7 @@
      * 
      * @return true if grouping is used,false otherwise.
      */
+    @Override
     public boolean isGroupingUsed() {
         return dform.isGroupingUsed();
     }
@@ -534,6 +544,7 @@
      * @param value
      *            the maximum number of fraction digits
      */
+    @Override
     public void setMaximumFractionDigits(int value) {
         super.setMaximumFractionDigits(value);
         dform.setMaximumFractionDigits(value);
@@ -548,6 +559,7 @@
      * @param value
      *            the maximum number of integer digits
      */
+    @Override
     public void setMaximumIntegerDigits(int value) {
         super.setMaximumIntegerDigits(value);
         dform.setMaximumIntegerDigits(value);
@@ -560,6 +572,7 @@
      * @param value
      *            the minimum number of fraction digits
      */
+    @Override
     public void setMinimumFractionDigits(int value) {
         super.setMinimumFractionDigits(value);
         dform.setMinimumFractionDigits(value);
@@ -572,6 +585,7 @@
      * @param value
      *            the minimum number of integer digits
      */
+    @Override
     public void setMinimumIntegerDigits(int value) {
         super.setMinimumIntegerDigits(value);
         dform.setMinimumIntegerDigits(value);
@@ -683,12 +697,13 @@
             new ObjectStreamField("serialVersionOnStream", int.class), }; //$NON-NLS-1$
 
     /**
-     * Writes serialized fields following serialized forms specified by Java specification. 
+     * Writes serialized fields following serialized forms specified by Java
+     * specification.
      * 
      * @param stream
-     *              the output stream to write serialized bytes
+     *            the output stream to write serialized bytes
      * @throws IOException
-     *              if some I/O error occurs
+     *             if some I/O error occurs
      * @throws ClassNotFoundException
      */
     private void writeObject(ObjectOutputStream stream) throws IOException,
@@ -732,14 +747,15 @@
     }
 
     /**
-     * Reads serialized fields following serialized forms specified by Java specification.
+     * Reads serialized fields following serialized forms specified by Java
+     * specification.
      * 
      * @param stream
-     *              the input stream to read serialized bytes
+     *            the input stream to read serialized bytes
      * @throws IOException
-     *              if some I/O error occurs
+     *             if some I/O error occurs
      * @throws ClassNotFoundException
-     *              if some class of serilized objects or fields cannot be found
+     *             if some class of serilized objects or fields cannot be found
      */
     private void readObject(ObjectInputStream stream) throws IOException,
             ClassNotFoundException {
@@ -773,7 +789,7 @@
         this.serialVersionOnStream = fields.get("serialVersionOnStream", 0); //$NON-NLS-1$
 
         Locale locale = (Locale) getInternalField("locale", symbols); //$NON-NLS-1$
-        dform = new com.ibm.icu.text.DecimalFormat("", // pattern, //$NON-NLS-1$
+        dform = new com.ibm.icu.text.DecimalFormat("", //$NON-NLS-1$
                 new com.ibm.icu.text.DecimalFormatSymbols(locale));
         setInternalField("useExponentialNotation", dform, new Boolean( //$NON-NLS-1$
                 useExponentialNotation));
@@ -801,7 +817,7 @@
                 || super.getMaximumFractionDigits() > Integer.MAX_VALUE
                 || super.getMinimumIntegerDigits() > Integer.MAX_VALUE) {
             // text.09=The deserialized date is invalid
-            throw new InvalidObjectException(Messages.getString("text.09"));  //$NON-NLS-1$
+            throw new InvalidObjectException(Messages.getString("text.09")); //$NON-NLS-1$
         }
         if (serialVersionOnStream < 3) {
             setMaximumIntegerDigits(super.getMinimumIntegerDigits());
@@ -819,19 +835,21 @@
     /*
      * Copies decimal format symbols from text object to ICU one.
      * 
-     * @param icu the object which recieves the new values.
-     * @param dfs the object which contains the new values.
+     * @param icu the object which recieves the new values. @param dfs the
+     * object which contains the new values.
      */
     private void copySymbols(final com.ibm.icu.text.DecimalFormatSymbols icu,
-                             final DecimalFormatSymbols dfs) {
+            final DecimalFormatSymbols dfs) {
         icu.setCurrency(com.ibm.icu.util.Currency.getInstance(dfs.getCurrency()
-                                                              .getCurrencyCode()));
+                .getCurrencyCode()));
         icu.setCurrencySymbol(dfs.getCurrencySymbol());
         icu.setDecimalSeparator(dfs.getDecimalSeparator());
         icu.setDigit(dfs.getDigit());
         icu.setGroupingSeparator(dfs.getGroupingSeparator());
         icu.setInfinity(dfs.getInfinity());
-        icu.setInternationalCurrencySymbol(dfs.getInternationalCurrencySymbol());
+        icu
+                .setInternationalCurrencySymbol(dfs
+                        .getInternationalCurrencySymbol());
         icu.setMinusSign(dfs.getMinusSign());
         icu.setMonetaryDecimalSeparator(dfs.getMonetaryDecimalSeparator());
         icu.setNaN(dfs.getNaN());