harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From telli...@apache.org
Subject svn commit: r462605 [6/8] - in /incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java: java/text/ org/apache/harmony/text/ org/apache/harmony/text/internal/nls/
Date Tue, 10 Oct 2006 22:18:37 GMT
Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/NumberFormat.java Tue Oct 10 15:18:35 2006
@@ -17,7 +17,6 @@
 
 package java.text;
 
-
 import java.io.IOException;
 import java.io.InvalidObjectException;
 import java.io.ObjectInputStream;
@@ -35,695 +34,701 @@
  */
 public abstract class NumberFormat extends Format {
 
-	private static final long serialVersionUID = -2308460125733713944L;
+    private static final long serialVersionUID = -2308460125733713944L;
 
-	/**
-	 * Field constant.
-	 */
-	public static final int INTEGER_FIELD = 0;
-
-	/**
-	 * Field constant.
-	 */
-	public static final int FRACTION_FIELD = 1;
-
-	private boolean groupingUsed = true, parseIntegerOnly = false;
-
-	private int maximumIntegerDigits = 40, minimumIntegerDigits = 1,
-			maximumFractionDigits = 3, minimumFractionDigits = 0;
-
-	/**
-	 * Constructs a new instance of DateFormat.
-	 */
-	public NumberFormat() {
-	}
-
-	/**
-	 * Answers a new NumberFormat with the same properties as this NumberFormat.
-	 * 
-	 * @return a shallow copy of this NumberFormat
-	 * 
-	 * @see java.lang.Cloneable
-	 */
-	public Object clone() {
-		return super.clone();
-	}
-
-	/**
-	 * Compares the specified object to this NumberFormat and answer if they are
-	 * equal. The object must be an instance of NumberFormat and have the same
-	 * properties.
-	 * 
-	 * @param object
-	 *            the object to compare with this object
-	 * @return true if the specified object is equal to this NumberFormat, false
-	 *         otherwise
-	 * 
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object) {
-		if (object == this) {
+    /**
+     * Field constant.
+     */
+    public static final int INTEGER_FIELD = 0;
+
+    /**
+     * Field constant.
+     */
+    public static final int FRACTION_FIELD = 1;
+
+    private boolean groupingUsed = true, parseIntegerOnly = false;
+
+    private int maximumIntegerDigits = 40, minimumIntegerDigits = 1,
+            maximumFractionDigits = 3, minimumFractionDigits = 0;
+
+    /**
+     * Constructs a new instance of DateFormat.
+     */
+    public NumberFormat() {
+    }
+
+    /**
+     * Answers a new NumberFormat with the same properties as this NumberFormat.
+     * 
+     * @return a shallow copy of this NumberFormat
+     * 
+     * @see java.lang.Cloneable
+     */
+    @Override
+    public Object clone() {
+        return super.clone();
+    }
+
+    /**
+     * Compares the specified object to this NumberFormat and answer if they are
+     * equal. The object must be an instance of NumberFormat and have the same
+     * properties.
+     * 
+     * @param object
+     *            the object to compare with this object
+     * @return true if the specified object is equal to this NumberFormat, false
+     *         otherwise
+     * 
+     * @see #hashCode
+     */
+    @Override
+    public boolean equals(Object object) {
+        if (object == this) {
             return true;
         }
-		if (!(object instanceof NumberFormat)) {
+        if (!(object instanceof NumberFormat)) {
             return false;
         }
-		NumberFormat obj = (NumberFormat) object;
-		return groupingUsed == obj.groupingUsed
-				&& parseIntegerOnly == obj.parseIntegerOnly
-				&& maximumFractionDigits == obj.maximumFractionDigits
-				&& maximumIntegerDigits == obj.maximumIntegerDigits
-				&& minimumFractionDigits == obj.minimumFractionDigits
-				&& minimumIntegerDigits == obj.minimumIntegerDigits;
-	}
-
-	/**
-	 * Formats the specified double using the rules of this NumberFormat.
-	 * 
-	 * @param value
-	 *            the double to format
-	 * @return the formatted String
-	 */
-	public final String format(double value) {
-		return format(value, new StringBuffer(), new FieldPosition(0))
-				.toString();
-	}
-
-	/**
-	 * Formats the double value into the specified StringBuffer using the rules
-	 * of this NumberFormat. If the field specified by the FieldPosition is
-	 * formatted, set the begin and end index of the formatted field in the
-	 * FieldPosition.
-	 * 
-	 * @param value
-	 *            the double to format
-	 * @param buffer
-	 *            the StringBuffer
-	 * @param field
-	 *            the FieldPosition
-	 * @return the StringBuffer parameter <code>buffer</code>
-	 */
-	public abstract StringBuffer format(double value, StringBuffer buffer,
-			FieldPosition field);
-
-	/**
-	 * Formats the specified long using the rules of this NumberFormat.
-	 * 
-	 * @param value
-	 *            the long to format
-	 * @return the formatted String
-	 */
-	public final String format(long value) {
-		return format(value, new StringBuffer(), new FieldPosition(0))
-				.toString();
-	}
-
-	/**
-	 * Formats the long value into the specified StringBuffer using the rules of
-	 * this NumberFormat. If the field specified by the FieldPosition is
-	 * formatted, set the begin and end index of the formatted field in the
-	 * FieldPosition.
-	 * 
-	 * @param value
-	 *            the long to format
-	 * @param buffer
-	 *            the StringBuffer
-	 * @param field
-	 *            the FieldPosition
-	 * @return the StringBuffer parameter <code>buffer</code>
-	 */
-	public abstract StringBuffer format(long value, StringBuffer buffer,
-			FieldPosition field);
-
-	/**
-	 * 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 Number
-	 * @param buffer
-	 *            the StringBuffer
-	 * @param field
-	 *            the FieldPosition
-	 * @return the StringBuffer parameter <code>buffer</code>
-	 * 
-	 * @exception IllegalArgumentException
-	 *                when the object is not a Number
-	 */
-	public StringBuffer format(Object object, StringBuffer buffer,
-			FieldPosition field) {
-		if (object instanceof Number) {
-			double dv = ((Number) object).doubleValue();
-			long lv = ((Number) object).longValue();
-			if (dv == lv) {
+        NumberFormat obj = (NumberFormat) object;
+        return groupingUsed == obj.groupingUsed
+                && parseIntegerOnly == obj.parseIntegerOnly
+                && maximumFractionDigits == obj.maximumFractionDigits
+                && maximumIntegerDigits == obj.maximumIntegerDigits
+                && minimumFractionDigits == obj.minimumFractionDigits
+                && minimumIntegerDigits == obj.minimumIntegerDigits;
+    }
+
+    /**
+     * Formats the specified double using the rules of this NumberFormat.
+     * 
+     * @param value
+     *            the double to format
+     * @return the formatted String
+     */
+    public final String format(double value) {
+        return format(value, new StringBuffer(), new FieldPosition(0))
+                .toString();
+    }
+
+    /**
+     * Formats the double value into the specified StringBuffer using the rules
+     * of this NumberFormat. If the field specified by the FieldPosition is
+     * formatted, set the begin and end index of the formatted field in the
+     * FieldPosition.
+     * 
+     * @param value
+     *            the double to format
+     * @param buffer
+     *            the StringBuffer
+     * @param field
+     *            the FieldPosition
+     * @return the StringBuffer parameter <code>buffer</code>
+     */
+    public abstract StringBuffer format(double value, StringBuffer buffer,
+            FieldPosition field);
+
+    /**
+     * Formats the specified long using the rules of this NumberFormat.
+     * 
+     * @param value
+     *            the long to format
+     * @return the formatted String
+     */
+    public final String format(long value) {
+        return format(value, new StringBuffer(), new FieldPosition(0))
+                .toString();
+    }
+
+    /**
+     * Formats the long value into the specified StringBuffer using the rules of
+     * this NumberFormat. If the field specified by the FieldPosition is
+     * formatted, set the begin and end index of the formatted field in the
+     * FieldPosition.
+     * 
+     * @param value
+     *            the long to format
+     * @param buffer
+     *            the StringBuffer
+     * @param field
+     *            the FieldPosition
+     * @return the StringBuffer parameter <code>buffer</code>
+     */
+    public abstract StringBuffer format(long value, StringBuffer buffer,
+            FieldPosition field);
+
+    /**
+     * 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 Number
+     * @param buffer
+     *            the StringBuffer
+     * @param field
+     *            the FieldPosition
+     * @return the StringBuffer parameter <code>buffer</code>
+     * 
+     * @exception IllegalArgumentException
+     *                when the object is not a Number
+     */
+    @Override
+    public StringBuffer format(Object object, StringBuffer buffer,
+            FieldPosition field) {
+        if (object instanceof Number) {
+            double dv = ((Number) object).doubleValue();
+            long lv = ((Number) object).longValue();
+            if (dv == lv) {
                 return format(lv, buffer, field);
             }
-			return format(dv, buffer, field);
-		}
-		throw new IllegalArgumentException();
-	}
-
-	/**
-	 * Gets the list of installed Locales which support NumberFormat.
-	 * 
-	 * @return an array of Locale
-	 */
-	public static Locale[] getAvailableLocales() {
-		return Locale.getAvailableLocales();
-	}
-
-	/**
-	 * Answers the currency used by this number format
-	 * <p>
-	 * This implementation throws UnsupportedOperationException, concrete sub
-	 * classes should override if they support currency formatting.
-	 * <p>
-	 * 
-	 * @return currency currency that was set in getInstance() or in
-	 *         setCurrency(), or null
-	 * @throws java.lang.UnsupportedOperationException
-	 */
-	public Currency getCurrency() {
-		throw new UnsupportedOperationException();
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing currency for the
-	 * default Locale.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public final static NumberFormat getCurrencyInstance() {
-		return getCurrencyInstance(Locale.getDefault());
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing currency for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a NumberFormat
-	 */
-	public static NumberFormat getCurrencyInstance(Locale locale) {
-		return getInstance(locale, "Currency"); //$NON-NLS-1$
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing integers for the
-	 * default Locale.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public final static NumberFormat getIntegerInstance() {
-		return getIntegerInstance(Locale.getDefault());
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing integers for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a NumberFormat
-	 */
-	public static NumberFormat getIntegerInstance(Locale locale) {
-		NumberFormat format = getInstance(locale, "Integer"); //$NON-NLS-1$
-		format.setParseIntegerOnly(true);
-		return format;
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing numbers for the default
-	 * Locale.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public final static NumberFormat getInstance() {
-		return getNumberInstance();
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing numbers for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a NumberFormat
-	 */
-	public static NumberFormat getInstance(Locale locale) {
-		return getNumberInstance(locale);
-	}
-
-	static NumberFormat getInstance(Locale locale, String type) {
-		return new DecimalFormat(getPattern(locale, type),
-				new DecimalFormatSymbols(locale));
-	}
-
-	/**
-	 * Answers the maximum number of fraction digits that are printed when
-	 * formatting. If the maximum is less than the number of fraction digits,
-	 * the least significant digits are truncated.
-	 * 
-	 * @return the maximum number of fraction digits
-	 */
-	public int getMaximumFractionDigits() {
-		return maximumFractionDigits;
-	}
-
-	/**
-	 * Answers the maximum number of integer digits that are printed when
-	 * formatting. If the maximum is less than the number of integer digits, the
-	 * most significant digits are truncated.
-	 * 
-	 * @return the maximum number of integer digits
-	 */
-	public int getMaximumIntegerDigits() {
-		return maximumIntegerDigits;
-	}
-
-	/**
-	 * Answers the minimum number of fraction digits that are printed when
-	 * formatting.
-	 * 
-	 * @return the minimum number of fraction digits
-	 */
-	public int getMinimumFractionDigits() {
-		return minimumFractionDigits;
-	}
-
-	/**
-	 * Answers the minimum number of integer digits that are printed when
-	 * formatting.
-	 * 
-	 * @return the minimum number of integer digits
-	 */
-	public int getMinimumIntegerDigits() {
-		return minimumIntegerDigits;
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing numbers for the default
-	 * Locale.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public final static NumberFormat getNumberInstance() {
-		return getNumberInstance(Locale.getDefault());
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing numbers for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a NumberFormat
-	 */
-	public static NumberFormat getNumberInstance(Locale locale) {
-		return getInstance(locale, "Number"); //$NON-NLS-1$
-	}
-
-	static String getPattern(Locale locale, String type) {
-		ResourceBundle bundle = getBundle(locale);
-		return bundle.getString(type);
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing percentages for the
-	 * default Locale.
-	 * 
-	 * @return a NumberFormat
-	 */
-	public final static NumberFormat getPercentInstance() {
-		return getPercentInstance(Locale.getDefault());
-	}
-
-	/**
-	 * Answers a NumberFormat for formatting and parsing percentages for the
-	 * specified Locale.
-	 * 
-	 * @param locale
-	 *            the Locale
-	 * @return a NumberFormat
-	 */
-	public static NumberFormat getPercentInstance(Locale locale) {
-		return getInstance(locale, "Percent"); //$NON-NLS-1$
-	}
-
-	/**
-	 * 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 (groupingUsed ? 1231 : 1237) + (parseIntegerOnly ? 1231 : 1237)
-				+ maximumFractionDigits + maximumIntegerDigits
-				+ minimumFractionDigits + minimumIntegerDigits;
-	}
-
-	/**
-	 * Answers whether this NumberFormat formats and parses numbers using a
-	 * grouping separator.
-	 * 
-	 * @return true when a grouping separator is used, false otherwise
-	 */
-	public boolean isGroupingUsed() {
-		return groupingUsed;
-	}
-
-	/**
-	 * Answers whether this NumberFormat only parses integer numbers. Parsing
-	 * stops if a decimal separator is encountered.
-	 * 
-	 * @return true if this NumberFormat only parses integers, false for parsing
-	 *         integers or fractions
-	 */
-	public boolean isParseIntegerOnly() {
-		return parseIntegerOnly;
-	}
-
-	/**
-	 * Parse a Number from the specified String using the rules of this
-	 * NumberFormat.
-	 * 
-	 * @param string
-	 *            the String to parse
-	 * @return the Number resulting from the parse
-	 * 
-	 * @exception ParseException
-	 *                when an error occurs during parsing
-	 */
-	public Number parse(String string) throws ParseException {
-		ParsePosition pos = new ParsePosition(0);
-		Number number = parse(string, pos);
-		if (pos.getErrorIndex() != -1 || pos.getIndex() == 0) {
+            return format(dv, buffer, field);
+        }
+        throw new IllegalArgumentException();
+    }
+
+    /**
+     * Gets the list of installed Locales which support NumberFormat.
+     * 
+     * @return an array of Locale
+     */
+    public static Locale[] getAvailableLocales() {
+        return Locale.getAvailableLocales();
+    }
+
+    /**
+     * Answers the currency used by this number format
+     * <p>
+     * This implementation throws UnsupportedOperationException, concrete sub
+     * classes should override if they support currency formatting.
+     * <p>
+     * 
+     * @return currency currency that was set in getInstance() or in
+     *         setCurrency(), or null
+     * @throws java.lang.UnsupportedOperationException
+     */
+    public Currency getCurrency() {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing currency for the
+     * default Locale.
+     * 
+     * @return a NumberFormat
+     */
+    public final static NumberFormat getCurrencyInstance() {
+        return getCurrencyInstance(Locale.getDefault());
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing currency for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     * @return a NumberFormat
+     */
+    public static NumberFormat getCurrencyInstance(Locale locale) {
+        return getInstance(locale, "Currency"); //$NON-NLS-1$
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing integers for the
+     * default Locale.
+     * 
+     * @return a NumberFormat
+     */
+    public final static NumberFormat getIntegerInstance() {
+        return getIntegerInstance(Locale.getDefault());
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing integers for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     * @return a NumberFormat
+     */
+    public static NumberFormat getIntegerInstance(Locale locale) {
+        NumberFormat format = getInstance(locale, "Integer"); //$NON-NLS-1$
+        format.setParseIntegerOnly(true);
+        return format;
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing numbers for the default
+     * Locale.
+     * 
+     * @return a NumberFormat
+     */
+    public final static NumberFormat getInstance() {
+        return getNumberInstance();
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing numbers for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     * @return a NumberFormat
+     */
+    public static NumberFormat getInstance(Locale locale) {
+        return getNumberInstance(locale);
+    }
+
+    static NumberFormat getInstance(Locale locale, String type) {
+        return new DecimalFormat(getPattern(locale, type),
+                new DecimalFormatSymbols(locale));
+    }
+
+    /**
+     * Answers the maximum number of fraction digits that are printed when
+     * formatting. If the maximum is less than the number of fraction digits,
+     * the least significant digits are truncated.
+     * 
+     * @return the maximum number of fraction digits
+     */
+    public int getMaximumFractionDigits() {
+        return maximumFractionDigits;
+    }
+
+    /**
+     * Answers the maximum number of integer digits that are printed when
+     * formatting. If the maximum is less than the number of integer digits, the
+     * most significant digits are truncated.
+     * 
+     * @return the maximum number of integer digits
+     */
+    public int getMaximumIntegerDigits() {
+        return maximumIntegerDigits;
+    }
+
+    /**
+     * Answers the minimum number of fraction digits that are printed when
+     * formatting.
+     * 
+     * @return the minimum number of fraction digits
+     */
+    public int getMinimumFractionDigits() {
+        return minimumFractionDigits;
+    }
+
+    /**
+     * Answers the minimum number of integer digits that are printed when
+     * formatting.
+     * 
+     * @return the minimum number of integer digits
+     */
+    public int getMinimumIntegerDigits() {
+        return minimumIntegerDigits;
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing numbers for the default
+     * Locale.
+     * 
+     * @return a NumberFormat
+     */
+    public final static NumberFormat getNumberInstance() {
+        return getNumberInstance(Locale.getDefault());
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing numbers for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     * @return a NumberFormat
+     */
+    public static NumberFormat getNumberInstance(Locale locale) {
+        return getInstance(locale, "Number"); //$NON-NLS-1$
+    }
+
+    static String getPattern(Locale locale, String type) {
+        ResourceBundle bundle = getBundle(locale);
+        return bundle.getString(type);
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing percentages for the
+     * default Locale.
+     * 
+     * @return a NumberFormat
+     */
+    public final static NumberFormat getPercentInstance() {
+        return getPercentInstance(Locale.getDefault());
+    }
+
+    /**
+     * Answers a NumberFormat for formatting and parsing percentages for the
+     * specified Locale.
+     * 
+     * @param locale
+     *            the Locale
+     * @return a NumberFormat
+     */
+    public static NumberFormat getPercentInstance(Locale locale) {
+        return getInstance(locale, "Percent"); //$NON-NLS-1$
+    }
+
+    /**
+     * 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 (groupingUsed ? 1231 : 1237) + (parseIntegerOnly ? 1231 : 1237)
+                + maximumFractionDigits + maximumIntegerDigits
+                + minimumFractionDigits + minimumIntegerDigits;
+    }
+
+    /**
+     * Answers whether this NumberFormat formats and parses numbers using a
+     * grouping separator.
+     * 
+     * @return true when a grouping separator is used, false otherwise
+     */
+    public boolean isGroupingUsed() {
+        return groupingUsed;
+    }
+
+    /**
+     * Answers whether this NumberFormat only parses integer numbers. Parsing
+     * stops if a decimal separator is encountered.
+     * 
+     * @return true if this NumberFormat only parses integers, false for parsing
+     *         integers or fractions
+     */
+    public boolean isParseIntegerOnly() {
+        return parseIntegerOnly;
+    }
+
+    /**
+     * Parse a Number from the specified String using the rules of this
+     * NumberFormat.
+     * 
+     * @param string
+     *            the String to parse
+     * @return the Number resulting from the parse
+     * 
+     * @exception ParseException
+     *                when an error occurs during parsing
+     */
+    public Number parse(String string) throws ParseException {
+        ParsePosition pos = new ParsePosition(0);
+        Number number = parse(string, pos);
+        if (pos.getErrorIndex() != -1 || pos.getIndex() == 0) {
             throw new ParseException(null, pos.getErrorIndex());
         }
-		return number;
-	}
+        return number;
+    }
+
+    /**
+     * Parse a Number 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 Number resulting from the parse, or null if there is an error
+     */
+    public abstract Number parse(String string, ParsePosition position);
+
+    /**
+     * Parse a Number 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 Number resulting from the parse, or null if there is an error
+     */
+    @Override
+    public final Object parseObject(String string, ParsePosition position) {
+        try {
+            return parse(string, position);
+        } catch (Exception e) {
+            return null;
+        }
+    }
 
-	/**
-	 * Parse a Number 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 Number resulting from the parse, or null if there is an error
-	 */
-	public abstract Number parse(String string, ParsePosition position);
-
-	/**
-	 * Parse a Number 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 Number resulting from the parse, or null if there is an error
-	 */
-	public final Object parseObject(String string, ParsePosition position) {
-		try {
-			return parse(string, position);
-		} catch (Exception e) {
-			return null;
-		}
-	}
-
-	/**
-	 * Sets the currency used by this number format when formatting currency
-	 * values.
-	 * <p>
-	 * The min and max fraction digits remain the same.
-	 * <p>
-	 * This implementation throws UnsupportedOperationException, concrete sub
-	 * classes should override if they support currency formatting.
-	 * <p>
-	 * 
-	 * @param currency
-	 *            the new Currency
-	 * @throws java.lang.UnsupportedOperationException
-	 */
-	public void setCurrency(Currency currency) {
-		throw new UnsupportedOperationException();
-	}
-
-	/**
-	 * Sets whether this NumberFormat formats and parses numbers using a
-	 * grouping separator.
-	 * 
-	 * @param value
-	 *            true when a grouping separator is used, false otherwise
-	 */
-	public void setGroupingUsed(boolean value) {
-		groupingUsed = value;
-	}
-
-	/**
-	 * Sets the maximum number of fraction digits that are printed when
-	 * formatting. If the maximum is less than the number of fraction digits,
-	 * the least significant digits are truncated.
-	 * 
-	 * @param value
-	 *            the maximum number of fraction digits
-	 */
-	public void setMaximumFractionDigits(int value) {
-		maximumFractionDigits = value < 0 ? 0 : value;
-		if (maximumFractionDigits < minimumFractionDigits) {
+    /**
+     * Sets the currency used by this number format when formatting currency
+     * values.
+     * <p>
+     * The min and max fraction digits remain the same.
+     * <p>
+     * This implementation throws UnsupportedOperationException, concrete sub
+     * classes should override if they support currency formatting.
+     * <p>
+     * 
+     * @param currency
+     *            the new Currency
+     * @throws java.lang.UnsupportedOperationException
+     */
+    public void setCurrency(Currency currency) {
+        throw new UnsupportedOperationException();
+    }
+
+    /**
+     * Sets whether this NumberFormat formats and parses numbers using a
+     * grouping separator.
+     * 
+     * @param value
+     *            true when a grouping separator is used, false otherwise
+     */
+    public void setGroupingUsed(boolean value) {
+        groupingUsed = value;
+    }
+
+    /**
+     * Sets the maximum number of fraction digits that are printed when
+     * formatting. If the maximum is less than the number of fraction digits,
+     * the least significant digits are truncated.
+     * 
+     * @param value
+     *            the maximum number of fraction digits
+     */
+    public void setMaximumFractionDigits(int value) {
+        maximumFractionDigits = value < 0 ? 0 : value;
+        if (maximumFractionDigits < minimumFractionDigits) {
             minimumFractionDigits = maximumFractionDigits;
         }
-	}
+    }
 
-	/**
-	 * Used to specify the new maximum count of integer digits that are printed
-	 * when formatting. If the maximum is less than the number of integer
-	 * digits, the most significant digits are truncated.
-	 * 
-	 * @param value
-	 *            the new maximum number of integer numerals for display
-	 */
-	public void setMaximumIntegerDigits(int value) {
-		maximumIntegerDigits = value < 0 ? 0 : value;
-		if (maximumIntegerDigits < minimumIntegerDigits) {
+    /**
+     * Used to specify the new maximum count of integer digits that are printed
+     * when formatting. If the maximum is less than the number of integer
+     * digits, the most significant digits are truncated.
+     * 
+     * @param value
+     *            the new maximum number of integer numerals for display
+     */
+    public void setMaximumIntegerDigits(int value) {
+        maximumIntegerDigits = value < 0 ? 0 : value;
+        if (maximumIntegerDigits < minimumIntegerDigits) {
             minimumIntegerDigits = maximumIntegerDigits;
         }
-	}
+    }
 
-	/**
-	 * Sets the minimum number of fraction digits that are printed when
-	 * formatting.
-	 * 
-	 * @param value
-	 *            the minimum number of fraction digits
-	 */
-	public void setMinimumFractionDigits(int value) {
-		minimumFractionDigits = value < 0 ? 0 : value;
-		if (maximumFractionDigits < minimumFractionDigits) {
+    /**
+     * Sets the minimum number of fraction digits that are printed when
+     * formatting.
+     * 
+     * @param value
+     *            the minimum number of fraction digits
+     */
+    public void setMinimumFractionDigits(int value) {
+        minimumFractionDigits = value < 0 ? 0 : value;
+        if (maximumFractionDigits < minimumFractionDigits) {
             maximumFractionDigits = minimumFractionDigits;
         }
-	}
+    }
 
-	/**
-	 * Sets the minimum number of integer digits that are printed when
-	 * formatting.
-	 * 
-	 * @param value
-	 *            the minimum number of integer digits
-	 */
-	public void setMinimumIntegerDigits(int value) {
-		minimumIntegerDigits = value < 0 ? 0 : value;
-		if (maximumIntegerDigits < minimumIntegerDigits) {
+    /**
+     * Sets the minimum number of integer digits that are printed when
+     * formatting.
+     * 
+     * @param value
+     *            the minimum number of integer digits
+     */
+    public void setMinimumIntegerDigits(int value) {
+        minimumIntegerDigits = value < 0 ? 0 : value;
+        if (maximumIntegerDigits < minimumIntegerDigits) {
             maximumIntegerDigits = minimumIntegerDigits;
         }
-	}
+    }
 
-	/**
-	 * Specifies if this NumberFormat should only parse numbers as integers or
-	 * else as any kind of number. If this is called with a <code>true</code>
-	 * value then subsequent parsing attempts will stop if a decimal separator
-	 * is encountered.
-	 * 
-	 * @param value
-	 *            <code>true</code> to only parse integers, <code>false</code>
-	 *            to parse integers and fractions
-	 */
-	public void setParseIntegerOnly(boolean value) {
-		parseIntegerOnly = value;
-	}
-
-	private static final ObjectStreamField[] serialPersistentFields = {
-			new ObjectStreamField("groupingUsed", Boolean.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("maxFractionDigits", Byte.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("maximumFractionDigits", Integer.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("maximumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("maxIntegerDigits", Byte.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("minFractionDigits", Byte.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("minimumFractionDigits", Integer.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("minimumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("minIntegerDigits", Byte.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("parseIntegerOnly", Boolean.TYPE), //$NON-NLS-1$
-			new ObjectStreamField("serialVersionOnStream", Integer.TYPE), }; //$NON-NLS-1$
-
-	private void writeObject(ObjectOutputStream stream) throws IOException {
-		ObjectOutputStream.PutField fields = stream.putFields();
-		fields.put("groupingUsed", groupingUsed); //$NON-NLS-1$
-		fields
-				.put(
-						"maxFractionDigits", //$NON-NLS-1$
-						maximumFractionDigits < Byte.MAX_VALUE ? (byte) maximumFractionDigits
-								: Byte.MAX_VALUE);
-		fields.put("maximumFractionDigits", maximumFractionDigits); //$NON-NLS-1$
-		fields.put("maximumIntegerDigits", maximumIntegerDigits); //$NON-NLS-1$
-		fields
-				.put(
-						"maxIntegerDigits", //$NON-NLS-1$
-						maximumIntegerDigits < Byte.MAX_VALUE ? (byte) maximumIntegerDigits
-								: Byte.MAX_VALUE);
-		fields
-				.put(
-						"minFractionDigits", //$NON-NLS-1$
-						minimumFractionDigits < Byte.MAX_VALUE ? (byte) minimumFractionDigits
-								: Byte.MAX_VALUE);
-		fields.put("minimumFractionDigits", minimumFractionDigits); //$NON-NLS-1$
-		fields.put("minimumIntegerDigits", minimumIntegerDigits); //$NON-NLS-1$
-		fields
-				.put(
-						"minIntegerDigits", //$NON-NLS-1$
-						minimumIntegerDigits < Byte.MAX_VALUE ? (byte) minimumIntegerDigits
-								: Byte.MAX_VALUE);
-		fields.put("parseIntegerOnly", parseIntegerOnly); //$NON-NLS-1$
-		fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
-		stream.writeFields();
-	}
-
-	private void readObject(ObjectInputStream stream) throws IOException,
-			ClassNotFoundException {
-		ObjectInputStream.GetField fields = stream.readFields();
-		groupingUsed = fields.get("groupingUsed", true); //$NON-NLS-1$
-		parseIntegerOnly = fields.get("parseIntegerOnly", false); //$NON-NLS-1$
-		if (fields.get("serialVersionOnStream", 0) == 0) { //$NON-NLS-1$
-			maximumFractionDigits = fields.get("maxFractionDigits", (byte) 3); //$NON-NLS-1$
-			maximumIntegerDigits = fields.get("maxIntegerDigits", (byte) 40); //$NON-NLS-1$
-			minimumFractionDigits = fields.get("minFractionDigits", (byte) 0); //$NON-NLS-1$
-			minimumIntegerDigits = fields.get("minIntegerDigits", (byte) 1); //$NON-NLS-1$
-		} else {
-			maximumFractionDigits = fields.get("maximumFractionDigits", 3); //$NON-NLS-1$
-			maximumIntegerDigits = fields.get("maximumIntegerDigits", 40); //$NON-NLS-1$
-			minimumFractionDigits = fields.get("minimumFractionDigits", 0); //$NON-NLS-1$
-			minimumIntegerDigits = fields.get("minimumIntegerDigits", 1); //$NON-NLS-1$
-		}
-		if (minimumIntegerDigits > maximumIntegerDigits
-				|| minimumFractionDigits > maximumFractionDigits) {
+    /**
+     * Specifies if this NumberFormat should only parse numbers as integers or
+     * else as any kind of number. If this is called with a <code>true</code>
+     * value then subsequent parsing attempts will stop if a decimal separator
+     * is encountered.
+     * 
+     * @param value
+     *            <code>true</code> to only parse integers, <code>false</code>
+     *            to parse integers and fractions
+     */
+    public void setParseIntegerOnly(boolean value) {
+        parseIntegerOnly = value;
+    }
+
+    private static final ObjectStreamField[] serialPersistentFields = {
+            new ObjectStreamField("groupingUsed", Boolean.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("maxFractionDigits", Byte.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("maximumFractionDigits", Integer.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("maximumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("maxIntegerDigits", Byte.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("minFractionDigits", Byte.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("minimumFractionDigits", Integer.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("minimumIntegerDigits", Integer.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("minIntegerDigits", Byte.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("parseIntegerOnly", Boolean.TYPE), //$NON-NLS-1$
+            new ObjectStreamField("serialVersionOnStream", Integer.TYPE), }; //$NON-NLS-1$
+
+    private void writeObject(ObjectOutputStream stream) throws IOException {
+        ObjectOutputStream.PutField fields = stream.putFields();
+        fields.put("groupingUsed", groupingUsed); //$NON-NLS-1$
+        fields
+                .put(
+                        "maxFractionDigits", //$NON-NLS-1$
+                        maximumFractionDigits < Byte.MAX_VALUE ? (byte) maximumFractionDigits
+                                : Byte.MAX_VALUE);
+        fields.put("maximumFractionDigits", maximumFractionDigits); //$NON-NLS-1$
+        fields.put("maximumIntegerDigits", maximumIntegerDigits); //$NON-NLS-1$
+        fields
+                .put(
+                        "maxIntegerDigits", //$NON-NLS-1$
+                        maximumIntegerDigits < Byte.MAX_VALUE ? (byte) maximumIntegerDigits
+                                : Byte.MAX_VALUE);
+        fields
+                .put(
+                        "minFractionDigits", //$NON-NLS-1$
+                        minimumFractionDigits < Byte.MAX_VALUE ? (byte) minimumFractionDigits
+                                : Byte.MAX_VALUE);
+        fields.put("minimumFractionDigits", minimumFractionDigits); //$NON-NLS-1$
+        fields.put("minimumIntegerDigits", minimumIntegerDigits); //$NON-NLS-1$
+        fields
+                .put(
+                        "minIntegerDigits", //$NON-NLS-1$
+                        minimumIntegerDigits < Byte.MAX_VALUE ? (byte) minimumIntegerDigits
+                                : Byte.MAX_VALUE);
+        fields.put("parseIntegerOnly", parseIntegerOnly); //$NON-NLS-1$
+        fields.put("serialVersionOnStream", 1); //$NON-NLS-1$
+        stream.writeFields();
+    }
+
+    private void readObject(ObjectInputStream stream) throws IOException,
+            ClassNotFoundException {
+        ObjectInputStream.GetField fields = stream.readFields();
+        groupingUsed = fields.get("groupingUsed", true); //$NON-NLS-1$
+        parseIntegerOnly = fields.get("parseIntegerOnly", false); //$NON-NLS-1$
+        if (fields.get("serialVersionOnStream", 0) == 0) { //$NON-NLS-1$
+            maximumFractionDigits = fields.get("maxFractionDigits", (byte) 3); //$NON-NLS-1$
+            maximumIntegerDigits = fields.get("maxIntegerDigits", (byte) 40); //$NON-NLS-1$
+            minimumFractionDigits = fields.get("minFractionDigits", (byte) 0); //$NON-NLS-1$
+            minimumIntegerDigits = fields.get("minIntegerDigits", (byte) 1); //$NON-NLS-1$
+        } else {
+            maximumFractionDigits = fields.get("maximumFractionDigits", 3); //$NON-NLS-1$
+            maximumIntegerDigits = fields.get("maximumIntegerDigits", 40); //$NON-NLS-1$
+            minimumFractionDigits = fields.get("minimumFractionDigits", 0); //$NON-NLS-1$
+            minimumIntegerDigits = fields.get("minimumIntegerDigits", 1); //$NON-NLS-1$
+        }
+        if (minimumIntegerDigits > maximumIntegerDigits
+                || minimumFractionDigits > maximumFractionDigits) {
             // text.00=min digits greater than max digits
             throw new InvalidObjectException(Messages.getString("text.00")); //$NON-NLS-1$
         }
-		if (minimumIntegerDigits < 0 || maximumIntegerDigits < 0
-				|| minimumFractionDigits < 0 || maximumFractionDigits < 0) {
+        if (minimumIntegerDigits < 0 || maximumIntegerDigits < 0
+                || minimumFractionDigits < 0 || maximumFractionDigits < 0) {
             // text.01=min or max digits negative
             throw new InvalidObjectException(Messages.getString("text.01")); //$NON-NLS-1$
         }
-	}
+    }
+
+    /**
+     * The instances of this inner class are used as attribute keys and values
+     * in AttributedCharacterIterator that
+     * NumberFormat.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 {
 
-	/**
-	 * The instances of this inner class are used as attribute keys and values
-	 * in AttributedCharacterIterator that
-	 * NumberFormat.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 = 7494728892700160890L;
 
-		public static final Field SIGN = new Field("sign"); //$NON-NLS-1$
+        public static final Field SIGN = new Field("sign"); //$NON-NLS-1$
 
-		public static final Field INTEGER = new Field("integer"); //$NON-NLS-1$
+        public static final Field INTEGER = new Field("integer"); //$NON-NLS-1$
 
-		public static final Field FRACTION = new Field("fraction"); //$NON-NLS-1$
+        public static final Field FRACTION = new Field("fraction"); //$NON-NLS-1$
 
-		public static final Field EXPONENT = new Field("exponent"); //$NON-NLS-1$
+        public static final Field EXPONENT = new Field("exponent"); //$NON-NLS-1$
 
-		public static final Field EXPONENT_SIGN = new Field("exponent sign"); //$NON-NLS-1$
+        public static final Field EXPONENT_SIGN = new Field("exponent sign"); //$NON-NLS-1$
 
-		public static final Field EXPONENT_SYMBOL = new Field("exponent symbol"); //$NON-NLS-1$
+        public static final Field EXPONENT_SYMBOL = new Field("exponent symbol"); //$NON-NLS-1$
 
-		public static final Field DECIMAL_SEPARATOR = new Field(
-				"decimal separator"); //$NON-NLS-1$
+        public static final Field DECIMAL_SEPARATOR = new Field(
+                "decimal separator"); //$NON-NLS-1$
 
-		public static final Field GROUPING_SEPARATOR = new Field(
-				"grouping separator"); //$NON-NLS-1$
+        public static final Field GROUPING_SEPARATOR = new Field(
+                "grouping separator"); //$NON-NLS-1$
 
-		public static final Field PERCENT = new Field("percent"); //$NON-NLS-1$
+        public static final Field PERCENT = new Field("percent"); //$NON-NLS-1$
 
-		public static final Field PERMILLE = new Field("per mille"); //$NON-NLS-1$
+        public static final Field PERMILLE = new Field("per mille"); //$NON-NLS-1$
 
-		public static final Field CURRENCY = new Field("currency"); //$NON-NLS-1$
+        public static final Field CURRENCY = new Field("currency"); //$NON-NLS-1$
 
-		/**
-		 * Constructs a new instance of NumberFormat.Field with the given field
-		 * name.
-		 */
-		protected Field(String fieldName) {
-			super(fieldName);
-		}
+        /**
+         * Constructs a new instance of NumberFormat.Field with the given field
+         * name.
+         */
+        protected Field(String fieldName) {
+            super(fieldName);
+        }
 
-		/**
-		 * serizalization method resolve instances to the constant
-		 * NumberFormat.Field values
-		 */
-		protected Object readResolve() throws InvalidObjectException {
-			if (this.equals(INTEGER)) {
+        /**
+         * serizalization method resolve instances to the constant
+         * NumberFormat.Field values
+         */
+        @Override
+        protected Object readResolve() throws InvalidObjectException {
+            if (this.equals(INTEGER)) {
                 return INTEGER;
             }
-			if (this.equals(FRACTION)) {
+            if (this.equals(FRACTION)) {
                 return FRACTION;
             }
-			if (this.equals(EXPONENT)) {
+            if (this.equals(EXPONENT)) {
                 return EXPONENT;
             }
-			if (this.equals(EXPONENT_SIGN)) {
+            if (this.equals(EXPONENT_SIGN)) {
                 return EXPONENT_SIGN;
             }
-			if (this.equals(EXPONENT_SYMBOL)) {
+            if (this.equals(EXPONENT_SYMBOL)) {
                 return EXPONENT_SYMBOL;
             }
-			if (this.equals(CURRENCY)) {
+            if (this.equals(CURRENCY)) {
                 return CURRENCY;
             }
-			if (this.equals(DECIMAL_SEPARATOR)) {
+            if (this.equals(DECIMAL_SEPARATOR)) {
                 return DECIMAL_SEPARATOR;
             }
-			if (this.equals(GROUPING_SEPARATOR)) {
+            if (this.equals(GROUPING_SEPARATOR)) {
                 return GROUPING_SEPARATOR;
             }
-			if (this.equals(PERCENT)) {
+            if (this.equals(PERCENT)) {
                 return PERCENT;
             }
-			if (this.equals(PERMILLE)) {
+            if (this.equals(PERMILLE)) {
                 return PERMILLE;
             }
-			if (this.equals(SIGN)) {
+            if (this.equals(SIGN)) {
                 return SIGN;
             }
-			// 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$
+        }
+    }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParseException.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParseException.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParseException.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParseException.java Tue Oct 10 15:18:35 2006
@@ -17,37 +17,36 @@
 
 package java.text;
 
-
 /**
  * A ParseException is thrown when the String being parsed is not in the correct
  * form.
  */
 public class ParseException extends Exception {
 
-	private static final long serialVersionUID = 2703218443322787634L;
+    private static final long serialVersionUID = 2703218443322787634L;
 
-	private int errorOffset;
+    private int errorOffset;
 
-	/**
-	 * Constructs a new instance of this class with its walkback, message and
-	 * the location of the error filled in.
-	 * 
-	 * @param detailMessage
-	 *            String The detail message for the exception.
-	 * @param location
-	 *            int The index at which the parse exception occurred.
-	 */
-	public ParseException(String detailMessage, int location) {
-		super(detailMessage);
-		errorOffset = location;
-	}
+    /**
+     * Constructs a new instance of this class with its walkback, message and
+     * the location of the error filled in.
+     * 
+     * @param detailMessage
+     *            String The detail message for the exception.
+     * @param location
+     *            int The index at which the parse exception occurred.
+     */
+    public ParseException(String detailMessage, int location) {
+        super(detailMessage);
+        errorOffset = location;
+    }
 
-	/**
-	 * Answers the index at which the parse exception occurred.
-	 * 
-	 * @return int The index of the parse exception.
-	 */
-	public int getErrorOffset() {
-		return errorOffset;
-	}
+    /**
+     * Answers the index at which the parse exception occurred.
+     * 
+     * @return int The index of the parse exception.
+     */
+    public int getErrorOffset() {
+        return errorOffset;
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParsePosition.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParsePosition.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParsePosition.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/ParsePosition.java Tue Oct 10 15:18:35 2006
@@ -17,101 +17,104 @@
 
 package java.text;
 
-
 /**
  * ParsePosition is used to track the current position in a String being parsed.
  */
 public class ParsePosition {
 
-	private int currentPosition, errorIndex = -1;
+    private int currentPosition, errorIndex = -1;
 
-	/**
-	 * Constructs a new ParsePosition at the specified index.
-	 * 
-	 * @param index
-	 *            the index to begin parsing
-	 */
-	public ParsePosition(int index) {
-		currentPosition = index;
-	}
-
-	/**
-	 * Compares the specified object to this ParsePosition and answer if they
-	 * are equal. The object must be an instance of ParsePosition and have the
-	 * same index and error index.
-	 * 
-	 * @param object
-	 *            the object to compare with this object
-	 * @return true if the specified object is equal to this ParsePosition,
-	 *         false otherwise
-	 * 
-	 * @see #hashCode
-	 */
-	public boolean equals(Object object) {
-		if (!(object instanceof ParsePosition))
-			return false;
-		ParsePosition pos = (ParsePosition) object;
-		return currentPosition == pos.currentPosition
-				&& errorIndex == pos.errorIndex;
-	}
-
-	/**
-	 * Answers the index at which the parse could not continue.
-	 * 
-	 * @return the index of the parse error, or -1 if there is no error
-	 */
-	public int getErrorIndex() {
-		return errorIndex;
-	}
-
-	/**
-	 * Answers the current parse position.
-	 * 
-	 * @return the current position
-	 */
-	public int getIndex() {
-		return currentPosition;
-	}
-
-	/**
-	 * 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 currentPosition + errorIndex;
-	}
-
-	/**
-	 * Sets the index at which the parse could not continue.
-	 * 
-	 * @param index
-	 *            the index of the parse error
-	 */
-	public void setErrorIndex(int index) {
-		errorIndex = index;
-	}
-
-	/**
-	 * Sets the current parse position.
-	 * 
-	 * @param index
-	 *            the current parse position
-	 */
-	public void setIndex(int index) {
-		currentPosition = index;
-	}
-
-	/**
-	 * Answers the string representation of this FieldPosition.
-	 * 
-	 * @return the string representation of this FieldPosition
-	 */
-	public String toString() {
-		return getClass().getName() + "[index=" + currentPosition //$NON-NLS-1$
-				+ ", errorIndex=" + errorIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$
-	}
+    /**
+     * Constructs a new ParsePosition at the specified index.
+     * 
+     * @param index
+     *            the index to begin parsing
+     */
+    public ParsePosition(int index) {
+        currentPosition = index;
+    }
+
+    /**
+     * Compares the specified object to this ParsePosition and answer if they
+     * are equal. The object must be an instance of ParsePosition and have the
+     * same index and error index.
+     * 
+     * @param object
+     *            the object to compare with this object
+     * @return true if the specified object is equal to this ParsePosition,
+     *         false otherwise
+     * 
+     * @see #hashCode
+     */
+    @Override
+    public boolean equals(Object object) {
+        if (!(object instanceof ParsePosition)) {
+            return false;
+        }
+        ParsePosition pos = (ParsePosition) object;
+        return currentPosition == pos.currentPosition
+                && errorIndex == pos.errorIndex;
+    }
+
+    /**
+     * Answers the index at which the parse could not continue.
+     * 
+     * @return the index of the parse error, or -1 if there is no error
+     */
+    public int getErrorIndex() {
+        return errorIndex;
+    }
+
+    /**
+     * Answers the current parse position.
+     * 
+     * @return the current position
+     */
+    public int getIndex() {
+        return currentPosition;
+    }
+
+    /**
+     * 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 currentPosition + errorIndex;
+    }
+
+    /**
+     * Sets the index at which the parse could not continue.
+     * 
+     * @param index
+     *            the index of the parse error
+     */
+    public void setErrorIndex(int index) {
+        errorIndex = index;
+    }
+
+    /**
+     * Sets the current parse position.
+     * 
+     * @param index
+     *            the current parse position
+     */
+    public void setIndex(int index) {
+        currentPosition = index;
+    }
+
+    /**
+     * Answers the string representation of this FieldPosition.
+     * 
+     * @return the string representation of this FieldPosition
+     */
+    @Override
+    public String toString() {
+        return getClass().getName() + "[index=" + currentPosition //$NON-NLS-1$
+                + ", errorIndex=" + errorIndex + "]"; //$NON-NLS-1$ //$NON-NLS-2$
+    }
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedBreakIterator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedBreakIterator.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedBreakIterator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedBreakIterator.java Tue Oct 10 15:18:35 2006
@@ -17,7 +17,6 @@
 
 package java.text;
 
-
 /*
  * Default implmentation of BreakIterator, wrap
  * com.ibm.icu.text.RuleBasedBreakIterator
@@ -25,167 +24,182 @@
  */
 class RuleBasedBreakIterator extends BreakIterator {
 
-	/*
-	 * Wraping construction
-	 */
-	RuleBasedBreakIterator(com.ibm.icu.text.BreakIterator iterator) {
-		super(iterator);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#current()
-	 */
-	public int current() {
-		return wrapped.current();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#first()
-	 */
-	public int first() {
-		return wrapped.first();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#following(int)
-	 */
-	public int following(int offset) {
-		validateOffset(offset);
-		return wrapped.following(offset);
-	}
-
-	/*
-	 * check the offset, throw exception if it is invalid
-	 */
-	private void validateOffset(int offset) {
-		CharacterIterator it = wrapped.getText();
-		if (offset < it.getBeginIndex() || offset >= it.getEndIndex()) {
-			throw new IllegalArgumentException();
-		}
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#getText()
-	 */
-	public CharacterIterator getText() {
-		return wrapped.getText();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#last()
-	 */
-	public int last() {
-		return wrapped.last();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#next()
-	 */
-	public int next() {
-		return wrapped.next();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#next(int)
-	 */
-	public int next(int n) {
-		return wrapped.next(n);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#previous()
-	 */
-	public int previous() {
-		return wrapped.previous();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#setText(java.text.CharacterIterator)
-	 */
-	public void setText(CharacterIterator newText) {
-		// call a method to check if null pointer
-		newText.current();
-		wrapped.setText(newText);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#isBoundary(int)
-	 */
-	public boolean isBoundary(int offset) {
-		validateOffset(offset);
-		return wrapped.isBoundary(offset);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.text.BreakIterator#preceding(int)
-	 */
-	public int preceding(int offset) {
-		validateOffset(offset);
-		return wrapped.preceding(offset);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#equals(java.lang.Object)
-	 */
-	public boolean equals(Object o) {
-		if (!(o instanceof RuleBasedBreakIterator)) {
-			return false;
-		}
-		return wrapped.equals(((RuleBasedBreakIterator) o).wrapped);
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#toString()
-	 */
-	public String toString() {
-		return wrapped.toString();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#hashCode()
-	 */
-	public int hashCode() {
-		return wrapped.hashCode();
-	}
-
-	/*
-	 * (non-Javadoc)
-	 * 
-	 * @see java.lang.Object#clone()
-	 */
-	public Object clone() {
-		RuleBasedBreakIterator cloned = (RuleBasedBreakIterator) super.clone();
-		cloned.wrapped = (com.ibm.icu.text.RuleBasedBreakIterator) wrapped
-				.clone();
-		return cloned;
-	}
+    /*
+     * Wraping construction
+     */
+    RuleBasedBreakIterator(com.ibm.icu.text.BreakIterator iterator) {
+        super(iterator);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#current()
+     */
+    @Override
+    public int current() {
+        return wrapped.current();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#first()
+     */
+    @Override
+    public int first() {
+        return wrapped.first();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#following(int)
+     */
+    @Override
+    public int following(int offset) {
+        validateOffset(offset);
+        return wrapped.following(offset);
+    }
+
+    /*
+     * check the offset, throw exception if it is invalid
+     */
+    private void validateOffset(int offset) {
+        CharacterIterator it = wrapped.getText();
+        if (offset < it.getBeginIndex() || offset >= it.getEndIndex()) {
+            throw new IllegalArgumentException();
+        }
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#getText()
+     */
+    @Override
+    public CharacterIterator getText() {
+        return wrapped.getText();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#last()
+     */
+    @Override
+    public int last() {
+        return wrapped.last();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#next()
+     */
+    @Override
+    public int next() {
+        return wrapped.next();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#next(int)
+     */
+    @Override
+    public int next(int n) {
+        return wrapped.next(n);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#previous()
+     */
+    @Override
+    public int previous() {
+        return wrapped.previous();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#setText(java.text.CharacterIterator)
+     */
+    @Override
+    public void setText(CharacterIterator newText) {
+        // call a method to check if null pointer
+        newText.current();
+        wrapped.setText(newText);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#isBoundary(int)
+     */
+    @Override
+    public boolean isBoundary(int offset) {
+        validateOffset(offset);
+        return wrapped.isBoundary(offset);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.text.BreakIterator#preceding(int)
+     */
+    @Override
+    public int preceding(int offset) {
+        validateOffset(offset);
+        return wrapped.preceding(offset);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#equals(java.lang.Object)
+     */
+    @Override
+    public boolean equals(Object o) {
+        if (!(o instanceof RuleBasedBreakIterator)) {
+            return false;
+        }
+        return wrapped.equals(((RuleBasedBreakIterator) o).wrapped);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    @Override
+    public String toString() {
+        return wrapped.toString();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#hashCode()
+     */
+    @Override
+    public int hashCode() {
+        return wrapped.hashCode();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#clone()
+     */
+    @Override
+    public Object clone() {
+        RuleBasedBreakIterator cloned = (RuleBasedBreakIterator) super.clone();
+        cloned.wrapped = (com.ibm.icu.text.RuleBasedBreakIterator) wrapped
+                .clone();
+        return cloned;
+    }
 
 }

Modified: incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedCollator.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedCollator.java?view=diff&rev=462605&r1=462604&r2=462605
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedCollator.java (original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/text/src/main/java/java/text/RuleBasedCollator.java Tue Oct 10 15:18:35 2006
@@ -19,7 +19,6 @@
 
 import org.apache.harmony.text.internal.nls.Messages;
 
-
 /**
  * <code>RuleBasedCollator</code> is a concrete subclass of
  * <code>Collator</code>. It allows customization of the
@@ -43,20 +42,20 @@
  */
 public class RuleBasedCollator extends Collator {
 
-	RuleBasedCollator(com.ibm.icu.text.Collator wrapper) {
-		super(wrapper);
-	}
-
-	/**
-	 * Constructs a new instance of <code>RuleBasedCollator</code> using the
-	 * specified <code>rules</code>.
-	 * 
-	 * @param rules
-	 *            the collation rules.
-	 * @throws ParseException
-	 *             when the rules contains an invalid collation rule syntax.
-	 */
-	public RuleBasedCollator(String rules) throws ParseException {
+    RuleBasedCollator(com.ibm.icu.text.Collator wrapper) {
+        super(wrapper);
+    }
+
+    /**
+     * Constructs a new instance of <code>RuleBasedCollator</code> using the
+     * specified <code>rules</code>.
+     * 
+     * @param rules
+     *            the collation rules.
+     * @throws ParseException
+     *             when the rules contains an invalid collation rule syntax.
+     */
+    public RuleBasedCollator(String rules) throws ParseException {
         if (rules == null) {
             throw new NullPointerException();
         }
@@ -68,140 +67,148 @@
         try {
             this.icuColl = new com.ibm.icu.text.RuleBasedCollator(rules);
         } catch (Exception e) {
-			if (e instanceof ParseException) {
-				throw (ParseException) e;
-			}
-			/*
-			 * -1 means it's not a ParseException. Maybe IOException thrown when
-			 * an error occured while reading internal data.
-			 */
-			throw new ParseException(e.getMessage(), -1);
-		}
-	}
-
-	/**
-	 * Obtains a <code>CollationElementIterator</code> for the given
-	 * <code>CharacterIterator</code>. The source iterator's integrity will
-	 * be preserved since a new copy will be created for use.
-	 * 
-	 * @param source
-	 *            the specified source
-	 * @return a <code>CollationElementIterator</code> for the source.
-	 */
-	public CollationElementIterator getCollationElementIterator(
-			CharacterIterator source) {
-		if (source == null)
-			throw new NullPointerException();
-		return new CollationElementIterator(
-				((com.ibm.icu.text.RuleBasedCollator) this.icuColl)
-						.getCollationElementIterator(source));
-	}
-
-	/**
-	 * Obtains a <code>CollationElementIterator</code> for the given String.
-	 * 
-	 * @param source
-	 *            the specified source
-	 * @return a <code>CollationElementIterator</code> for the given String
-	 */
-	public CollationElementIterator getCollationElementIterator(String source) {
-		if (source == null)
-			throw new NullPointerException();
-		return new CollationElementIterator(
-				((com.ibm.icu.text.RuleBasedCollator) this.icuColl)
-						.getCollationElementIterator(source));
-	}
-
-	/**
-	 * Obtains the collation rules of the <code>RuleBasedCollator</code>.
-	 * 
-	 * @return the collation rules.
-	 */
-	public String getRules() {
-		return ((com.ibm.icu.text.RuleBasedCollator) this.icuColl).getRules();
-	}
-
-	/**
-	 * Obtains the cloned object of the <code>RuleBasedCollator</code>
-	 * 
-	 * @return the cloned object of the <code>RuleBasedCollator</code>
-	 */
-	public Object clone() {
-		RuleBasedCollator clone = (RuleBasedCollator) super.clone();
-		return clone;
-	}
-
-	/**
-	 * Compares the <code>source</code> text <code>String</code> to the
-	 * <code>target</code> text <code>String</code> according to the
-	 * collation rules, strength and decomposition mode for this
-	 * <code>RuleBasedCollator</code>. See the <code>Collator</code> class
-	 * description for an example of use.
-	 * <p>
-	 * General recommendation: If comparisons are to be done to the same String
-	 * multiple times, it would be more efficient to generate
-	 * <code>CollationKeys</code> for the <code>String</code> s and use
-	 * <code>CollationKey.compareTo(CollationKey)</code> for the comparisons.
-	 * If the each Strings are compared to only once, using the method
-	 * RuleBasedCollator.compare(String, String) will have a better performance.
-	 * </p>
-	 * 
-	 * @param source
-	 *            the source text
-	 * @param target
-	 *            the target text
-	 * @return an integer which may be a negative value, zero, or else a
-	 *         positive value depending on whether <code>source</code> is less
-	 *         than, equivalent to, or greater than <code>target</code>.
-	 */
-	public int compare(String source, String target) {
+            if (e instanceof ParseException) {
+                throw (ParseException) e;
+            }
+            /*
+             * -1 means it's not a ParseException. Maybe IOException thrown when
+             * an error occured while reading internal data.
+             */
+            throw new ParseException(e.getMessage(), -1);
+        }
+    }
+
+    /**
+     * Obtains a <code>CollationElementIterator</code> for the given
+     * <code>CharacterIterator</code>. The source iterator's integrity will
+     * be preserved since a new copy will be created for use.
+     * 
+     * @param source
+     *            the specified source
+     * @return a <code>CollationElementIterator</code> for the source.
+     */
+    public CollationElementIterator getCollationElementIterator(
+            CharacterIterator source) {
+        if (source == null) {
+            throw new NullPointerException();
+        }
+        return new CollationElementIterator(
+                ((com.ibm.icu.text.RuleBasedCollator) this.icuColl)
+                        .getCollationElementIterator(source));
+    }
+
+    /**
+     * Obtains a <code>CollationElementIterator</code> for the given String.
+     * 
+     * @param source
+     *            the specified source
+     * @return a <code>CollationElementIterator</code> for the given String
+     */
+    public CollationElementIterator getCollationElementIterator(String source) {
+        if (source == null) {
+            throw new NullPointerException();
+        }
+        return new CollationElementIterator(
+                ((com.ibm.icu.text.RuleBasedCollator) this.icuColl)
+                        .getCollationElementIterator(source));
+    }
+
+    /**
+     * Obtains the collation rules of the <code>RuleBasedCollator</code>.
+     * 
+     * @return the collation rules.
+     */
+    public String getRules() {
+        return ((com.ibm.icu.text.RuleBasedCollator) this.icuColl).getRules();
+    }
+
+    /**
+     * Obtains the cloned object of the <code>RuleBasedCollator</code>
+     * 
+     * @return the cloned object of the <code>RuleBasedCollator</code>
+     */
+    @Override
+    public Object clone() {
+        RuleBasedCollator clone = (RuleBasedCollator) super.clone();
+        return clone;
+    }
+
+    /**
+     * Compares the <code>source</code> text <code>String</code> to the
+     * <code>target</code> text <code>String</code> according to the
+     * collation rules, strength and decomposition mode for this
+     * <code>RuleBasedCollator</code>. See the <code>Collator</code> class
+     * description for an example of use.
+     * <p>
+     * General recommendation: If comparisons are to be done to the same String
+     * multiple times, it would be more efficient to generate
+     * <code>CollationKeys</code> for the <code>String</code> s and use
+     * <code>CollationKey.compareTo(CollationKey)</code> for the comparisons.
+     * If the each Strings are compared to only once, using the method
+     * RuleBasedCollator.compare(String, String) will have a better performance.
+     * </p>
+     * 
+     * @param source
+     *            the source text
+     * @param target
+     *            the target text
+     * @return an integer which may be a negative value, zero, or else a
+     *         positive value depending on whether <code>source</code> is less
+     *         than, equivalent to, or greater than <code>target</code>.
+     */
+    @Override
+    public int compare(String source, String target) {
         if (source == null || target == null) {
             // text.08=one of arguments is null
             throw new NullPointerException(Messages.getString("text.08")); //$NON-NLS-1$
         }
-		return this.icuColl.compare(source, target);
-	}
+        return this.icuColl.compare(source, target);
+    }
 
-	/**
-	 * Obtains the <code>CollationKey</code> for the given source text.
-	 * 
-	 * @param source
-	 *            the speicifed source text
-	 * @return the <code>CollationKey</code> for the given source text.
-	 */
-	public CollationKey getCollationKey(String source) {
-		com.ibm.icu.text.CollationKey icuKey = this.icuColl
-				.getCollationKey(source);
-		if (icuKey == null) {
-			return null;
-		}
-		return new CollationKey(source, icuKey);
-	}
-
-	/**
-	 * Obtains a unique hash code for the <code>RuleBasedCollator</code>
-	 * 
-	 * @return the hash code for the <code>RuleBasedCollator</code>
-	 */
-	public int hashCode() {
-		return ((com.ibm.icu.text.RuleBasedCollator) this.icuColl).getRules()
-				.hashCode();
-	}
-
-	/**
-	 * Compares the equality of two <code>RuleBasedCollator</code> objects.
-	 * <code>RuleBasedCollator</code> objects are equal if they have the same
-	 * collation rules and the same attributes.
-	 * 
-	 * @param obj
-	 *            the other object.
-	 * @return <code>true</code> if this <code>RuleBasedCollator</code> has
-	 *         exactly the same collation behaviour as obj, <code>false</code>
-	 *         otherwise.
-	 */
-	public boolean equals(Object obj) {
-		if (!(obj instanceof Collator))
-			return false;
-		return super.equals(obj);
-	}
+    /**
+     * Obtains the <code>CollationKey</code> for the given source text.
+     * 
+     * @param source
+     *            the speicifed source text
+     * @return the <code>CollationKey</code> for the given source text.
+     */
+    @Override
+    public CollationKey getCollationKey(String source) {
+        com.ibm.icu.text.CollationKey icuKey = this.icuColl
+                .getCollationKey(source);
+        if (icuKey == null) {
+            return null;
+        }
+        return new CollationKey(source, icuKey);
+    }
+
+    /**
+     * Obtains a unique hash code for the <code>RuleBasedCollator</code>
+     * 
+     * @return the hash code for the <code>RuleBasedCollator</code>
+     */
+    @Override
+    public int hashCode() {
+        return ((com.ibm.icu.text.RuleBasedCollator) this.icuColl).getRules()
+                .hashCode();
+    }
+
+    /**
+     * Compares the equality of two <code>RuleBasedCollator</code> objects.
+     * <code>RuleBasedCollator</code> objects are equal if they have the same
+     * collation rules and the same attributes.
+     * 
+     * @param obj
+     *            the other object.
+     * @return <code>true</code> if this <code>RuleBasedCollator</code> has
+     *         exactly the same collation behaviour as obj, <code>false</code>
+     *         otherwise.
+     */
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof Collator)) {
+            return false;
+        }
+        return super.equals(obj);
+    }
 }



Mime
View raw message