summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorElliott Hughes <enh@google.com>2010-04-16 11:06:58 -0700
committerElliott Hughes <enh@google.com>2010-04-16 11:06:58 -0700
commitb7e820b92c7345cdc0cd4fea50954289ae66eb67 (patch)
tree4cb16a5101296e3a89f8c869073b5352f3020953
parente875cc0c3dc0ecb816fc154ddcfba38c064d00e2 (diff)
downloadlibcore-b7e820b92c7345cdc0cd4fea50954289ae66eb67.zip
libcore-b7e820b92c7345cdc0cd4fea50954289ae66eb67.tar.gz
libcore-b7e820b92c7345cdc0cd4fea50954289ae66eb67.tar.bz2
Change DecimalFormatSymbols to have a field per symbol.
I'd been wanting to do this for some time, but cleaning up the recent performance changes I made to Formatter was the final straw. Change-Id: I6d516de66a0bed5e759bca590b4cc124ce2eb712
-rw-r--r--icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java50
-rw-r--r--icu/src/main/native/Resources.cpp73
-rw-r--r--luni/src/main/java/java/util/Formatter.java16
-rw-r--r--luni/src/main/java/org/apache/harmony/luni/util/LocaleCache.java1
-rw-r--r--text/src/main/java/java/text/DecimalFormatSymbols.java147
5 files changed, 156 insertions, 131 deletions
diff --git a/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java b/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java
index e8572a2..0ba18d1 100644
--- a/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java
+++ b/icu/src/main/java/com/ibm/icu4jni/util/LocaleData.java
@@ -50,8 +50,16 @@ public final class LocaleData {
public String mediumDateFormat;
public String shortDateFormat;
- public String decimalPatternChars;
-
+ // DecimalFormatSymbols.
+ public char zeroDigit;
+ public char digit;
+ public char decimalSeparator;
+ public char groupingSeparator;
+ public char patternSeparator;
+ public char percent;
+ public char perMill;
+ public char monetarySeparator;
+ public char minusSign;
public String exponentSeparator;
public String infinity;
public String NaN;
@@ -82,7 +90,15 @@ public final class LocaleData {
"longDateFormat=" + longDateFormat + "," +
"mediumDateFormat=" + mediumDateFormat + "," +
"shortDateFormat=" + shortDateFormat + "," +
- "decimalPatternChars=" + decimalPatternChars + "," +
+ "zeroDigit=" + zeroDigit + "," +
+ "digit=" + digit + "," +
+ "decimalSeparator=" + decimalSeparator + "," +
+ "groupingSeparator=" + groupingSeparator + "," +
+ "patternSeparator=" + patternSeparator + "," +
+ "percent=" + percent + "," +
+ "perMill=" + perMill + "," +
+ "monetarySeparator=" + monetarySeparator + "," +
+ "minusSign=" + minusSign + "," +
"exponentSeparator=" + exponentSeparator + "," +
"infinity=" + infinity + "," +
"NaN=" + NaN + "," +
@@ -143,8 +159,32 @@ public final class LocaleData {
if (overrides.shortDateFormat != null) {
shortDateFormat = overrides.shortDateFormat;
}
- if (overrides.decimalPatternChars != null) {
- decimalPatternChars = overrides.decimalPatternChars;
+ if (overrides.zeroDigit != '\0') {
+ zeroDigit = overrides.zeroDigit;
+ }
+ if (overrides.digit != '\0') {
+ digit = overrides.digit;
+ }
+ if (overrides.decimalSeparator != '\0') {
+ decimalSeparator = overrides.decimalSeparator;
+ }
+ if (overrides.groupingSeparator != '\0') {
+ groupingSeparator = overrides.groupingSeparator;
+ }
+ if (overrides.patternSeparator != '\0') {
+ patternSeparator = overrides.patternSeparator;
+ }
+ if (overrides.percent != '\0') {
+ percent = overrides.percent;
+ }
+ if (overrides.perMill != '\0') {
+ perMill = overrides.perMill;
+ }
+ if (overrides.monetarySeparator != '\0') {
+ monetarySeparator = overrides.monetarySeparator;
+ }
+ if (overrides.minusSign != '\0') {
+ minusSign = overrides.minusSign;
}
if (overrides.exponentSeparator != null) {
exponentSeparator = overrides.exponentSeparator;
diff --git a/icu/src/main/native/Resources.cpp b/icu/src/main/native/Resources.cpp
index ba363fe..fb53f87 100644
--- a/icu/src/main/native/Resources.cpp
+++ b/icu/src/main/native/Resources.cpp
@@ -541,58 +541,18 @@ static jobjectArray getShortWeekdayNames(JNIEnv* env, UResourceBundle* gregorian
return getWeekdayNames(env, gregorian, false);
}
-static jstring getDecimalPatternChars(JNIEnv* env, UResourceBundle* rootElems) {
- UErrorCode status = U_ZERO_ERROR;
-
- int zeroL, digitL, decSepL, groupL, listL, percentL, permillL, currSepL, minusL;
-
- const jchar* zero = ures_getStringByIndex(rootElems, 4, &zeroL, &status);
- const jchar* digit = ures_getStringByIndex(rootElems, 5, &digitL, &status);
- const jchar* decSep = ures_getStringByIndex(rootElems, 0, &decSepL, &status);
- const jchar* group = ures_getStringByIndex(rootElems, 1, &groupL, &status);
- const jchar* list = ures_getStringByIndex(rootElems, 2, &listL, &status);
- const jchar* percent = ures_getStringByIndex(rootElems, 3, &percentL, &status);
- const jchar* permill = ures_getStringByIndex(rootElems, 8, &permillL, &status);
- const jchar* currSep = ures_getStringByIndex(rootElems, 0, &currSepL, &status);
- const jchar* minus = ures_getStringByIndex(rootElems, 6, &minusL, &status);
-
- if (U_FAILURE(status)) {
- return NULL;
- }
-
- jchar patternChars[] = {
- zero[0],
- digit[0],
- decSep[0],
- group[0],
- list[0],
- percent[0],
- permill[0],
- currSep[0],
- minus[0],
- };
- return env->NewString(patternChars, sizeof(patternChars));
-}
-
static jstring getIntCurrencyCode(JNIEnv* env, jstring locale) {
- const char* locStr = env->GetStringUTFChars(locale, NULL);
+ ScopedUtfChars localeChars(env, locale);
// Extract the 2-character country name.
- if (strlen(locStr) < 5) {
- env->ReleaseStringUTFChars(locale, locStr);
+ if (strlen(localeChars.data()) < 5) {
return NULL;
}
- if (locStr[3] < 'A' || locStr[3] > 'Z' || locStr[4] < 'A' || locStr[4] > 'Z') {
- env->ReleaseStringUTFChars(locale, locStr);
+ if (localeChars[3] < 'A' || localeChars[3] > 'Z' || localeChars[4] < 'A' || localeChars[4] > 'Z') {
return NULL;
}
- char country[3] = {0,0,0};
- country[0] = locStr[3];
- country[1] = locStr[4];
-
- env->ReleaseStringUTFChars(locale, locStr);
-
+ char country[3] = { localeChars[3], localeChars[4], 0 };
return getCurrencyCodeNative(env, NULL, env->NewStringUTF(country));
}
@@ -627,7 +587,20 @@ static void setStringField(JNIEnv* env, jobject obj, const char* fieldName, URes
if (U_SUCCESS(status)) {
setStringField(env, obj, fieldName, env->NewString(chars, charCount));
} else {
- LOGE("Error setting field %s from ICU resource: %s", fieldName, u_errorName(status));
+ LOGE("Error setting String field %s from ICU resource: %s", fieldName, u_errorName(status));
+ }
+}
+
+static void setCharField(JNIEnv* env, jobject obj, const char* fieldName, UResourceBundle* bundle, int index) {
+ UErrorCode status = U_ZERO_ERROR;
+ int charCount;
+ const UChar* chars = ures_getStringByIndex(bundle, index, &charCount, &status);
+ if (U_SUCCESS(status)) {
+ jclass localeDataClass = env->FindClass("com/ibm/icu4jni/util/LocaleData");
+ jfieldID fid = env->GetFieldID(localeDataClass, fieldName, "C");
+ env->SetCharField(obj, fid, chars[0]);
+ } else {
+ LOGE("Error setting char field %s from ICU resource: %s", fieldName, u_errorName(status));
}
}
@@ -683,7 +656,15 @@ static jboolean initLocaleDataImpl(JNIEnv* env, jclass clazz, jstring locale, jo
ScopedResourceBundle numberElements(ures_getByKey(root.get(), "NumberElements", NULL, &status));
if (U_SUCCESS(status) && ures_getSize(numberElements.get()) >= 11) {
- setStringField(env, localeData, "decimalPatternChars", getDecimalPatternChars(env, numberElements.get()));
+ setCharField(env, localeData, "zeroDigit", numberElements.get(), 4);
+ setCharField(env, localeData, "digit", numberElements.get(), 5);
+ setCharField(env, localeData, "decimalSeparator", numberElements.get(), 0);
+ setCharField(env, localeData, "groupingSeparator", numberElements.get(), 1);
+ setCharField(env, localeData, "patternSeparator", numberElements.get(), 2);
+ setCharField(env, localeData, "percent", numberElements.get(), 3);
+ setCharField(env, localeData, "perMill", numberElements.get(), 8);
+ setCharField(env, localeData, "monetarySeparator", numberElements.get(), 0);
+ setCharField(env, localeData, "minusSign", numberElements.get(), 6);
setStringField(env, localeData, "exponentSeparator", numberElements.get(), 7);
setStringField(env, localeData, "infinity", numberElements.get(), 9);
setStringField(env, localeData, "NaN", numberElements.get(), 10);
diff --git a/luni/src/main/java/java/util/Formatter.java b/luni/src/main/java/java/util/Formatter.java
index d7812be..f79fde9 100644
--- a/luni/src/main/java/java/util/Formatter.java
+++ b/luni/src/main/java/java/util/Formatter.java
@@ -1444,7 +1444,7 @@ public final class Formatter implements Closeable, Flushable {
break;
case 'd':
if (arg instanceof Integer || arg instanceof Long || arg instanceof Short || arg instanceof Byte) {
- if (localeData.decimalPatternChars.charAt(0) == '0') { // ZERO_DIGIT
+ if (localeData.zeroDigit == '0') {
return arg.toString();
}
}
@@ -1655,7 +1655,7 @@ public final class Formatter implements Closeable, Flushable {
char paddingChar = '\u0020'; // space as padding char.
if (formatToken.flagZero) {
if (formatToken.getConversionType() == 'd') {
- paddingChar = localeData.decimalPatternChars.charAt(0); // ZERO_DIGIT
+ paddingChar = localeData.zeroDigit;
} else {
paddingChar = '0'; // No localized digits for bases other than decimal.
}
@@ -1725,7 +1725,7 @@ public final class Formatter implements Closeable, Flushable {
}
if ('d' == currentConversionType) {
- if (formatToken.flagComma || localeData.decimalPatternChars.charAt(0) != '0') { // ZERO_DIGIT
+ if (formatToken.flagComma || localeData.zeroDigit != '0') {
NumberFormat numberFormat = getNumberFormat();
numberFormat.setGroupingUsed(formatToken.flagComma);
result.append(numberFormat.format(arg));
@@ -1897,7 +1897,7 @@ public final class Formatter implements Closeable, Flushable {
formatToken.setPrecision(FormatToken.UNSET);
- if (localeData.decimalPatternChars.charAt(8) == result.charAt(0)) { // MINUS_SIGN
+ if (localeData.minusSign == result.charAt(0)) {
if (formatToken.flagParenthesis) {
return wrapParentheses(result);
}
@@ -1913,7 +1913,7 @@ public final class Formatter implements Closeable, Flushable {
}
char firstChar = result.charAt(0);
- if (formatToken.flagZero && (firstChar == floatUtil.getAddSign() || firstChar == localeData.decimalPatternChars.charAt(8))) { // MINUS_SIGN
+ if (formatToken.flagZero && (firstChar == floatUtil.getAddSign() || firstChar == localeData.minusSign)) {
startIndex = 1;
}
@@ -2097,7 +2097,7 @@ public final class Formatter implements Closeable, Flushable {
private void appendLocalized(StringBuilder result, long value, int width) {
int paddingIndex = result.length();
- char zeroDigit = localeData.decimalPatternChars.charAt(0); // ZERO_DIGIT
+ char zeroDigit = localeData.zeroDigit;
if (zeroDigit == '0') {
result.append(value);
} else {
@@ -2177,7 +2177,7 @@ public final class Formatter implements Closeable, Flushable {
// if the flag is sharp and decimal separator is always given out.
if (formatToken.flagSharp && formatToken.getPrecision() == 0) {
int indexOfE = result.indexOf("e");
- result.insert(indexOfE, localeData.decimalPatternChars.charAt(2)); // DECIMAL_SEPARATOR
+ result.insert(indexOfE, localeData.decimalSeparator);
}
}
@@ -2274,7 +2274,7 @@ public final class Formatter implements Closeable, Flushable {
result.append(decimalFormat.format(argument));
// if the flag is sharp and decimal separator is always given out.
if (formatToken.flagSharp && formatToken.getPrecision() == 0) {
- result.append(localeData.decimalPatternChars.charAt(2)); // DECIMAL_SEPARATOR
+ result.append(localeData.decimalSeparator);
}
}
diff --git a/luni/src/main/java/org/apache/harmony/luni/util/LocaleCache.java b/luni/src/main/java/org/apache/harmony/luni/util/LocaleCache.java
index 7b9957d..98b3f9b 100644
--- a/luni/src/main/java/org/apache/harmony/luni/util/LocaleCache.java
+++ b/luni/src/main/java/org/apache/harmony/luni/util/LocaleCache.java
@@ -18,7 +18,6 @@
package org.apache.harmony.luni.util;
import java.text.NumberFormat;
-import java.text.DecimalFormatSymbols;
import java.util.Locale;
/**
diff --git a/text/src/main/java/java/text/DecimalFormatSymbols.java b/text/src/main/java/java/text/DecimalFormatSymbols.java
index 7188745..b1144a8 100644
--- a/text/src/main/java/java/text/DecimalFormatSymbols.java
+++ b/text/src/main/java/java/text/DecimalFormatSymbols.java
@@ -43,26 +43,21 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
private static final long serialVersionUID = 5772796243397350300L;
- // Indexes into the patternChars array.
- private static final int ZERO_DIGIT = 0;
- private static final int DIGIT = 1;
- private static final int DECIMAL_SEPARATOR = 2;
- private static final int GROUPING_SEPARATOR = 3;
- private static final int PATTERN_SEPARATOR = 4;
- private static final int PERCENT = 5;
- private static final int PER_MILL = 6;
- private static final int MONETARY_DECIMAL_SEPARATOR = 7;
- private static final int MINUS_SIGN = 8;
-
- // TODO: replace this with individual char fields.
- private transient char[] patternChars;
+ private char zeroDigit;
+ private char digit;
+ private char decimalSeparator;
+ private char groupingSeparator;
+ private char patternSeparator;
+ private char percent;
+ private char perMill;
+ private char monetarySeparator;
+ private char minusSign;
+ private String infinity, NaN, currencySymbol, intlCurrencySymbol;
private transient Currency currency;
private transient Locale locale;
private transient String exponentSeparator;
- private String infinity, NaN, currencySymbol, intlCurrencySymbol;
-
/**
* Constructs a new {@code DecimalFormatSymbols} containing the symbols for
* the user's default locale.
@@ -89,7 +84,15 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
public DecimalFormatSymbols(Locale locale) {
// BEGIN android-changed
LocaleData localeData = com.ibm.icu4jni.util.Resources.getLocaleData(locale);
- this.patternChars = localeData.decimalPatternChars.toCharArray();
+ this.zeroDigit = localeData.zeroDigit;
+ this.digit = localeData.digit;
+ this.decimalSeparator = localeData.decimalSeparator;
+ this.groupingSeparator = localeData.groupingSeparator;
+ this.patternSeparator = localeData.patternSeparator;
+ this.percent = localeData.percent;
+ this.perMill = localeData.perMill;
+ this.monetarySeparator = localeData.monetarySeparator;
+ this.minusSign = localeData.minusSign;
this.infinity = localeData.infinity;
this.NaN = localeData.NaN;
this.exponentSeparator = localeData.exponentSeparator;
@@ -144,22 +147,12 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
return Resources.getAvailableDecimalFormatSymbolsLocales();
}
- /**
- * Returns a new {@code DecimalFormatSymbols} with the same symbols as this
- * {@code DecimalFormatSymbols}.
- *
- * @return a shallow copy of this {@code DecimalFormatSymbols}.
- *
- * @see java.lang.Cloneable
- */
@Override
public Object clone() {
try {
- DecimalFormatSymbols symbols = (DecimalFormatSymbols) super.clone();
- symbols.patternChars = patternChars.clone();
- return symbols;
+ return super.clone();
} catch (CloneNotSupportedException e) {
- throw new AssertionError(e); // android-changed
+ throw new AssertionError(e);
}
}
@@ -185,19 +178,19 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
DecimalFormatSymbols obj = (DecimalFormatSymbols) object;
return currency.equals(obj.currency) &&
currencySymbol.equals(obj.currencySymbol) &&
- patternChars[DECIMAL_SEPARATOR] == obj.patternChars[DECIMAL_SEPARATOR] &&
- patternChars[DIGIT] == obj.patternChars[DIGIT] &&
+ decimalSeparator == obj.decimalSeparator &&
+ digit == obj.digit &&
exponentSeparator.equals(obj.exponentSeparator) &&
- patternChars[GROUPING_SEPARATOR] == obj.patternChars[GROUPING_SEPARATOR] &&
+ groupingSeparator == obj.groupingSeparator &&
infinity.equals(obj.infinity) &&
intlCurrencySymbol.equals(obj.intlCurrencySymbol) &&
- patternChars[MINUS_SIGN] == obj.patternChars[MINUS_SIGN] &&
- patternChars[MONETARY_DECIMAL_SEPARATOR] == obj.patternChars[MONETARY_DECIMAL_SEPARATOR] &&
+ minusSign == obj.minusSign &&
+ monetarySeparator == obj.monetarySeparator &&
NaN.equals(obj.NaN) &&
- patternChars[PATTERN_SEPARATOR] == obj.patternChars[PATTERN_SEPARATOR] &&
- patternChars[PER_MILL] == obj.patternChars[PER_MILL] &&
- patternChars[PERCENT] == obj.patternChars[PERCENT] &&
- patternChars[ZERO_DIGIT] == obj.patternChars[ZERO_DIGIT];
+ patternSeparator == obj.patternSeparator &&
+ perMill == obj.perMill &&
+ percent == obj.percent &&
+ zeroDigit == obj.zeroDigit;
}
@Override
@@ -205,19 +198,19 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
return getClass().getName() +
"[currency=" + currency +
",currencySymbol=" + currencySymbol +
- ",decimalSeparator=" + patternChars[DECIMAL_SEPARATOR] +
- ",digit=" + patternChars[DIGIT] +
+ ",decimalSeparator=" + decimalSeparator +
+ ",digit=" + digit +
",exponentSeparator=" + exponentSeparator +
- ",groupingSeparator=" + patternChars[GROUPING_SEPARATOR] +
+ ",groupingSeparator=" + groupingSeparator +
",infinity=" + infinity +
",intlCurrencySymbol=" + intlCurrencySymbol +
- ",minusSign=" + patternChars[MINUS_SIGN] +
- ",monetaryDecimalSeparator=" + patternChars[MONETARY_DECIMAL_SEPARATOR] +
+ ",minusSign=" + minusSign +
+ ",monetarySeparator=" + monetarySeparator +
",NaN=" + NaN +
- ",patternSeparator=" + patternChars[PATTERN_SEPARATOR] +
- ",perMill=" + patternChars[PER_MILL] +
- ",percent=" + patternChars[PERCENT] +
- ",zeroDigit=" + patternChars[ZERO_DIGIT] +
+ ",patternSeparator=" + patternSeparator +
+ ",perMill=" + perMill +
+ ",percent=" + percent +
+ ",zeroDigit=" + zeroDigit +
"]";
}
@@ -263,7 +256,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the decimal separator character.
*/
public char getDecimalSeparator() {
- return patternChars[DECIMAL_SEPARATOR];
+ return decimalSeparator;
}
/**
@@ -273,7 +266,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the digit pattern character.
*/
public char getDigit() {
- return patternChars[DIGIT];
+ return digit;
}
/**
@@ -282,7 +275,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the thousands separator character.
*/
public char getGroupingSeparator() {
- return patternChars[GROUPING_SEPARATOR];
+ return groupingSeparator;
}
/**
@@ -300,7 +293,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the minus sign as a character.
*/
public char getMinusSign() {
- return patternChars[MINUS_SIGN];
+ return minusSign;
}
/**
@@ -310,7 +303,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the monetary decimal point as a character.
*/
public char getMonetaryDecimalSeparator() {
- return patternChars[MONETARY_DECIMAL_SEPARATOR];
+ return monetarySeparator;
}
/**
@@ -329,7 +322,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the pattern separator character.
*/
public char getPatternSeparator() {
- return patternChars[PATTERN_SEPARATOR];
+ return patternSeparator;
}
/**
@@ -338,7 +331,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the percent character.
*/
public char getPercent() {
- return patternChars[PERCENT];
+ return percent;
}
/**
@@ -347,7 +340,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the per mill sign character.
*/
public char getPerMill() {
- return patternChars[PER_MILL];
+ return perMill;
}
/**
@@ -356,7 +349,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* @return the zero character.
*/
public char getZeroDigit() {
- return patternChars[ZERO_DIGIT];
+ return zeroDigit;
}
/*
@@ -370,9 +363,22 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
@Override
public int hashCode() {
- return new String(patternChars).hashCode() + exponentSeparator.hashCode() +
- infinity.hashCode() + NaN.hashCode() + currencySymbol.hashCode() +
- intlCurrencySymbol.hashCode();
+ int result = 17;
+ result = 31*result + zeroDigit;
+ result = 31*result + digit;
+ result = 31*result + decimalSeparator;
+ result = 31*result + groupingSeparator;
+ result = 31*result + patternSeparator;
+ result = 31*result + percent;
+ result = 31*result + perMill;
+ result = 31*result + monetarySeparator;
+ result = 31*result + minusSign;
+ result = 31*result + exponentSeparator.hashCode();
+ result = 31*result + infinity.hashCode();
+ result = 31*result + NaN.hashCode();
+ result = 31*result + currencySymbol.hashCode();
+ result = 31*result + intlCurrencySymbol.hashCode();
+ return result;
}
/**
@@ -437,7 +443,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the currency symbol.
*/
public void setCurrencySymbol(String value) {
- currencySymbol = value;
+ this.currencySymbol = value;
}
/**
@@ -447,7 +453,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the decimal separator character.
*/
public void setDecimalSeparator(char value) {
- patternChars[DECIMAL_SEPARATOR] = value;
+ this.decimalSeparator = value;
}
/**
@@ -457,7 +463,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the digit character.
*/
public void setDigit(char value) {
- patternChars[DIGIT] = value;
+ this.digit = value;
}
/**
@@ -467,7 +473,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the grouping separator character.
*/
public void setGroupingSeparator(char value) {
- patternChars[GROUPING_SEPARATOR] = value;
+ this.groupingSeparator = value;
}
/**
@@ -477,7 +483,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the string representing infinity.
*/
public void setInfinity(String value) {
- infinity = value;
+ this.infinity = value;
}
/**
@@ -487,7 +493,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the minus sign character.
*/
public void setMinusSign(char value) {
- patternChars[MINUS_SIGN] = value;
+ this.minusSign = value;
}
/**
@@ -498,7 +504,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the monetary decimal separator character.
*/
public void setMonetaryDecimalSeparator(char value) {
- patternChars[MONETARY_DECIMAL_SEPARATOR] = value;
+ this.monetarySeparator = value;
}
/**
@@ -508,7 +514,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the string representing NaN.
*/
public void setNaN(String value) {
- NaN = value;
+ this.NaN = value;
}
/**
@@ -519,7 +525,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the pattern separator character.
*/
public void setPatternSeparator(char value) {
- patternChars[PATTERN_SEPARATOR] = value;
+ this.patternSeparator = value;
}
/**
@@ -529,7 +535,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the percent character.
*/
public void setPercent(char value) {
- patternChars[PERCENT] = value;
+ this.percent = value;
}
/**
@@ -539,7 +545,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the per mill character.
*/
public void setPerMill(char value) {
- patternChars[PER_MILL] = value;
+ this.perMill = value;
}
/**
@@ -549,7 +555,7 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
* the zero digit character.
*/
public void setZeroDigit(char value) {
- patternChars[ZERO_DIGIT] = value;
+ this.zeroDigit = value;
}
/**
@@ -609,7 +615,6 @@ public final class DecimalFormatSymbols implements Cloneable, Serializable {
private void readObject(ObjectInputStream stream) throws IOException, ClassNotFoundException {
ObjectInputStream.GetField fields = stream.readFields();
final int serialVersionOnStream = fields.get("serialVersionOnStream", 0);
- patternChars = new char[9];
currencySymbol = (String) fields.get("currencySymbol", "");
setDecimalSeparator(fields.get("decimalSeparator", '.'));
setDigit(fields.get("digit", '#'));