ICU-12869 Don't use ordinal() to define public constants.

Review URL: https://codereview.appspot.com/317990043 .

X-SVN-Rev: 39525
This commit is contained in:
Fredrik Roubert 2016-12-05 20:49:33 +00:00
parent f6bad27e9c
commit 48989879a8
2 changed files with 13 additions and 7 deletions

View File

@ -12,6 +12,7 @@ import java.util.Collections;
import java.util.Map;
import com.ibm.icu.text.CurrencyDisplayNames;
import com.ibm.icu.text.DecimalFormatSymbols;
import com.ibm.icu.util.ULocale;
public class CurrencyData {
@ -47,7 +48,15 @@ public class CurrencyData {
private final String[][] symbols = new String[SpacingType.COUNT.ordinal()][SpacingPattern.COUNT.ordinal()];
public static enum SpacingType { BEFORE, AFTER, COUNT };
public static enum SpacingPattern { CURRENCY_MATCH, SURROUNDING_MATCH, INSERT_BETWEEN, COUNT };
public static enum SpacingPattern {
CURRENCY_MATCH(DecimalFormatSymbols.CURRENCY_SPC_CURRENCY_MATCH),
SURROUNDING_MATCH(DecimalFormatSymbols.CURRENCY_SPC_SURROUNDING_MATCH),
INSERT_BETWEEN(DecimalFormatSymbols.CURRENCY_SPC_INSERT),
COUNT;
SpacingPattern() {}
SpacingPattern(int value) { assert value == ordinal(); }
};
public CurrencySpacingInfo() {}

View File

@ -1014,23 +1014,20 @@ public class DecimalFormatSymbols implements Cloneable, Serializable {
* {@icu} Indicates the currency match pattern used in {@link #getPatternForCurrencySpacing}.
* @stable ICU 4.2
*/
public static final int CURRENCY_SPC_CURRENCY_MATCH =
CurrencySpacingInfo.SpacingPattern.CURRENCY_MATCH.ordinal();
public static final int CURRENCY_SPC_CURRENCY_MATCH = 0;
/**
* {@icu} Indicates the surrounding match pattern used in {@link
* #getPatternForCurrencySpacing}.
* @stable ICU 4.2
*/
public static final int CURRENCY_SPC_SURROUNDING_MATCH =
CurrencySpacingInfo.SpacingPattern.SURROUNDING_MATCH.ordinal();
public static final int CURRENCY_SPC_SURROUNDING_MATCH = 1;
/**
* {@icu} Indicates the insertion value used in {@link #getPatternForCurrencySpacing}.
* @stable ICU 4.4
*/
public static final int CURRENCY_SPC_INSERT =
CurrencySpacingInfo.SpacingPattern.INSERT_BETWEEN.ordinal();
public static final int CURRENCY_SPC_INSERT = 2;
private String[] currencySpcBeforeSym;
private String[] currencySpcAfterSym;