Update from "primary" to "default" in rule-based code
diff --git a/icu4c/source/i18n/nfrs.cpp b/icu4c/source/i18n/nfrs.cpp
index efa7a36..1510d88 100644
--- a/icu4c/source/i18n/nfrs.cpp
+++ b/icu4c/source/i18n/nfrs.cpp
@@ -37,7 +37,7 @@
/** 0.x */
PROPER_FRACTION_RULE_INDEX = 2,
/** x.0 */
- PRIMARY_RULE_INDEX = 3,
+ DEFAULT_RULE_INDEX = 3,
/** Inf */
INFINITY_RULE_INDEX = 4,
/** NaN */
@@ -278,8 +278,8 @@
else if (baseValue == NFRule::kProperFractionRule) {
setBestFractionRule(PROPER_FRACTION_RULE_INDEX, rule, TRUE);
}
- else if (baseValue == NFRule::kPrimaryRule) {
- setBestFractionRule(PRIMARY_RULE_INDEX, rule, TRUE);
+ else if (baseValue == NFRule::kDefaultRule) {
+ setBestFractionRule(DEFAULT_RULE_INDEX, rule, TRUE);
}
else if (baseValue == NFRule::kInfinityRule) {
delete nonNumericalRules[INFINITY_RULE_INDEX];
@@ -323,7 +323,7 @@
for (int i = 0; i < NON_NUMERICAL_RULE_LENGTH; i++) {
if (i != IMPROPER_FRACTION_RULE_INDEX
&& i != PROPER_FRACTION_RULE_INDEX
- && i != PRIMARY_RULE_INDEX)
+ && i != DEFAULT_RULE_INDEX)
{
delete nonNumericalRules[i];
}
@@ -375,7 +375,7 @@
rules[i]->setDecimalFormatSymbols(newSymbols, status);
}
// Switch the fraction rules to mirror the DecimalFormatSymbols.
- for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= PRIMARY_RULE_INDEX; nonNumericalIdx++) {
+ for (int32_t nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX; nonNumericalIdx <= DEFAULT_RULE_INDEX; nonNumericalIdx++) {
if (nonNumericalRules[nonNumericalIdx]) {
for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) {
NFRule *fractionRule = fractionRules[fIdx];
@@ -472,9 +472,9 @@
}
}
- // if there's a primary rule, use it to format the number
- if (nonNumericalRules[PRIMARY_RULE_INDEX]) {
- return nonNumericalRules[PRIMARY_RULE_INDEX];
+ // if there's a default rule, use it to format the number
+ if (nonNumericalRules[DEFAULT_RULE_INDEX]) {
+ return nonNumericalRules[DEFAULT_RULE_INDEX];
}
// and if we haven't yet returned a rule, use findNormalRule()
@@ -507,13 +507,13 @@
// do them in findRule(), because the version of format() that
// takes a long bypasses findRule() and goes straight to this
// function. This function does skip the fraction rules since
- // we know the value is an integer (it also skips the primary
+ // we know the value is an integer (it also skips the default
// rule, since it's considered a fraction rule. Skipping the
- // primary rule in this function is also how we avoid infinite
+ // default rule in this function is also how we avoid infinite
// recursion)
// {dlf} unfortunately this fails if there are no rules except
- // special rules. If there are no rules, use the primary rule.
+ // special rules. If there are no rules, use the default rule.
// binary-search the rule list for the applicable rule
// (a rule is used for all values from its base value to
@@ -553,8 +553,8 @@
}
return result;
}
- // else use the primary rule
- return nonNumericalRules[PRIMARY_RULE_INDEX];
+ // else use the default rule
+ return nonNumericalRules[DEFAULT_RULE_INDEX];
}
/**
@@ -792,7 +792,7 @@
if (nonNumericalRules[i]) {
if (rule->getBaseValue() == NFRule::kImproperFractionRule
|| rule->getBaseValue() == NFRule::kProperFractionRule
- || rule->getBaseValue() == NFRule::kPrimaryRule)
+ || rule->getBaseValue() == NFRule::kDefaultRule)
{
for (uint32_t fIdx = 0; fIdx < fractionRules.size(); fIdx++) {
NFRule *fractionRule = fractionRules[fIdx];
diff --git a/icu4c/source/i18n/nfrule.cpp b/icu4c/source/i18n/nfrule.cpp
index 160924c..a9b84ed 100644
--- a/icu4c/source/i18n/nfrule.cpp
+++ b/icu4c/source/i18n/nfrule.cpp
@@ -153,7 +153,7 @@
if ((rule1->baseValue > 0
&& (rule1->baseValue % util64_pow(rule1->radix, rule1->exponent)) == 0)
|| rule1->getType() == kImproperFractionRule
- || rule1->getType() == kPrimaryRule) {
+ || rule1->getType() == kDefaultRule) {
// if it passes that test, new up the second rule. If the
// rule set both rules will belong to is a fraction rule
@@ -181,9 +181,9 @@
}
// if the description began with "x.0" and contains bracketed
- // text, it describes both the primary rule and the
+ // text, it describes both the default rule and the
// improper fraction rule
- else if (rule1->getType() == kPrimaryRule) {
+ else if (rule1->getType() == kDefaultRule) {
rule2->baseValue = rule1->baseValue;
rule1->setType(kImproperFractionRule);
}
@@ -376,7 +376,7 @@
decimalPoint = descriptor.charAt(1);
}
else if (firstChar == gX && lastChar == gZero) {
- setBaseValue(kPrimaryRule, status);
+ setBaseValue(kDefaultRule, status);
decimalPoint = descriptor.charAt(1);
}
else if (descriptor.compare(gNaN, 3) == 0) {
@@ -663,7 +663,7 @@
case kNegativeNumberRule: result.append(gMinusX, 2); break;
case kImproperFractionRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break;
case kProperFractionRule: result.append(gZero).append(decimalPoint == 0 ? gDot : decimalPoint).append(gX); break;
- case kPrimaryRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gZero); break;
+ case kDefaultRule: result.append(gX).append(decimalPoint == 0 ? gDot : decimalPoint).append(gZero); break;
case kInfinityRule: result.append(gInf, 3); break;
case kNaNRule: result.append(gNaN, 3); break;
default:
diff --git a/icu4c/source/i18n/nfrule.h b/icu4c/source/i18n/nfrule.h
index 084a984..989fbaa 100644
--- a/icu4c/source/i18n/nfrule.h
+++ b/icu4c/source/i18n/nfrule.h
@@ -38,7 +38,7 @@
kNegativeNumberRule = -1,
kImproperFractionRule = -2,
kProperFractionRule = -3,
- kPrimaryRule = -4,
+ kDefaultRule = -4,
kInfinityRule = -5,
kNaNRule = -6,
kOtherRule = -7
diff --git a/icu4c/source/i18n/nfsubs.cpp b/icu4c/source/i18n/nfsubs.cpp
index 1934fa7..e3d1fc1 100644
--- a/icu4c/source/i18n/nfsubs.cpp
+++ b/icu4c/source/i18n/nfsubs.cpp
@@ -342,7 +342,7 @@
// IntegralPartSubstitution
else if (rule->getBaseValue() == NFRule::kImproperFractionRule
|| rule->getBaseValue() == NFRule::kProperFractionRule
- || rule->getBaseValue() == NFRule::kPrimaryRule) {
+ || rule->getBaseValue() == NFRule::kDefaultRule) {
return new IntegralPartSubstitution(pos, ruleSet, description, status);
}
@@ -371,7 +371,7 @@
// FractionalPartSubstitution
else if (rule->getBaseValue() == NFRule::kImproperFractionRule
|| rule->getBaseValue() == NFRule::kProperFractionRule
- || rule->getBaseValue() == NFRule::kPrimaryRule) {
+ || rule->getBaseValue() == NFRule::kDefaultRule) {
return new FractionalPartSubstitution(pos, ruleSet, description, status);
}
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/NFRule.java b/icu4j/main/classes/core/src/com/ibm/icu/text/NFRule.java
index ed483e9..75ac157 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/NFRule.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/NFRule.java
@@ -41,9 +41,9 @@
static final int PROPER_FRACTION_RULE = -3;
/**
- * Special base value used to identify a primary rule
+ * Special base value used to identify a default rule
*/
- static final int PRIMARY_RULE = -4;
+ static final int DEFAULT_RULE = -4;
/**
* Special base value used to identify an infinity rule
@@ -169,7 +169,7 @@
if ((rule1.baseValue > 0
&& rule1.baseValue % (power(rule1.radix, rule1.exponent)) == 0)
|| rule1.baseValue == IMPROPER_FRACTION_RULE
- || rule1.baseValue == PRIMARY_RULE)
+ || rule1.baseValue == DEFAULT_RULE)
{
// if it passes that test, new up the second rule. If the
@@ -190,9 +190,9 @@
// the proper fraction rule
rule2.baseValue = PROPER_FRACTION_RULE;
}
- else if (rule1.baseValue == PRIMARY_RULE) {
+ else if (rule1.baseValue == DEFAULT_RULE) {
// if the description began with "x.0" and contains bracketed
- // text, it describes both the primary rule and the
+ // text, it describes both the default rule and the
// improper fraction rule
rule2.baseValue = rule1.baseValue;
rule1.baseValue = IMPROPER_FRACTION_RULE;
@@ -378,7 +378,7 @@
decimalPoint = descriptor.charAt(1);
}
else if (firstChar == 'x' && lastChar == '0') {
- setBaseValue(PRIMARY_RULE);
+ setBaseValue(DEFAULT_RULE);
decimalPoint = descriptor.charAt(1);
}
else if (descriptor.equals("NaN")) {
@@ -651,7 +651,7 @@
else if (baseValue == PROPER_FRACTION_RULE) {
result.append('0').append(decimalPoint == 0 ? '.' : decimalPoint).append("x: ");
}
- else if (baseValue == PRIMARY_RULE) {
+ else if (baseValue == DEFAULT_RULE) {
result.append('x').append(decimalPoint == 0 ? '.' : decimalPoint).append("0: ");
}
else if (baseValue == INFINITY_RULE) {
@@ -1222,7 +1222,7 @@
* Used by stripPrefix() to match characters. If lenient parse mode
* is off, this just calls startsWith(). If lenient parse mode is on,
* this function uses CollationElementIterators to match characters in
- * the strings (only primary-order differences are significant in
+ * the strings (primary-order differences are significant in
* determining whether there's a match).
* @param str The string being tested
* @param prefix The text we're hoping to see at the beginning
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java b/icu4j/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
index 992a3c1..978d748 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/NFRuleSet.java
@@ -57,7 +57,7 @@
/** 0.x */
static final int PROPER_FRACTION_RULE_INDEX = 2;
/** x.0 */
- static final int PRIMARY_RULE_INDEX = 3;
+ static final int DEFAULT_RULE_INDEX = 3;
/** Inf */
static final int INFINITY_RULE_INDEX = 4;
/** NaN */
@@ -243,8 +243,8 @@
else if (baseValue == NFRule.PROPER_FRACTION_RULE) {
setBestFractionRule(NFRuleSet.PROPER_FRACTION_RULE_INDEX, rule, true);
}
- else if (baseValue == NFRule.PRIMARY_RULE) {
- setBestFractionRule(NFRuleSet.PRIMARY_RULE_INDEX, rule, true);
+ else if (baseValue == NFRule.DEFAULT_RULE) {
+ setBestFractionRule(NFRuleSet.DEFAULT_RULE_INDEX, rule, true);
}
else if (baseValue == NFRule.INFINITY_RULE) {
nonNumericalRules[NFRuleSet.INFINITY_RULE_INDEX] = rule;
@@ -368,7 +368,7 @@
if (rule != null) {
if (rule.getBaseValue() == NFRule.IMPROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.PROPER_FRACTION_RULE
- || rule.getBaseValue() == NFRule.PRIMARY_RULE)
+ || rule.getBaseValue() == NFRule.DEFAULT_RULE)
{
for (NFRule fractionRule : fractionRules) {
if (fractionRule.getBaseValue() == rule.getBaseValue()) {
@@ -508,9 +508,9 @@
}
}
- // if there's a primary rule, use it to format the number
- if (nonNumericalRules[PRIMARY_RULE_INDEX] != null) {
- return nonNumericalRules[PRIMARY_RULE_INDEX];
+ // if there's a default rule, use it to format the number
+ if (nonNumericalRules[DEFAULT_RULE_INDEX] != null) {
+ return nonNumericalRules[DEFAULT_RULE_INDEX];
}
else {
// and if we haven't yet returned a rule, use findNormalRule()
@@ -557,9 +557,9 @@
// do them in findRule(), because the version of format() that
// takes a long bypasses findRule() and goes straight to this
// function. This function does skip the fraction rules since
- // we know the value is an integer (it also skips the primary
+ // we know the value is an integer (it also skips the default
// rule, since it's considered a fraction rule. Skipping the
- // primary rule in this function is also how we avoid infinite
+ // default rule in this function is also how we avoid infinite
// recursion)
// binary-search the rule list for the applicable rule
@@ -600,8 +600,8 @@
}
return result;
}
- // else use the primary rule
- return nonNumericalRules[PRIMARY_RULE_INDEX];
+ // else use the default rule
+ return nonNumericalRules[DEFAULT_RULE_INDEX];
}
/**
@@ -830,7 +830,7 @@
// Switch the fraction rules to mirror the DecimalFormatSymbols.
if (fractionRules != null) {
for (int nonNumericalIdx = IMPROPER_FRACTION_RULE_INDEX;
- nonNumericalIdx <= PRIMARY_RULE_INDEX; nonNumericalIdx++) {
+ nonNumericalIdx <= DEFAULT_RULE_INDEX; nonNumericalIdx++) {
if (nonNumericalRules[nonNumericalIdx] != null) {
for (NFRule rule : fractionRules) {
if (nonNumericalRules[nonNumericalIdx].getBaseValue() == rule.getBaseValue()) {
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/NFSubstitution.java b/icu4j/main/classes/core/src/com/ibm/icu/text/NFSubstitution.java
index fc07ef5..65db0c2 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/NFSubstitution.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/NFSubstitution.java
@@ -90,7 +90,7 @@
}
else if (rule.getBaseValue() == NFRule.IMPROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.PROPER_FRACTION_RULE
- || rule.getBaseValue() == NFRule.PRIMARY_RULE)
+ || rule.getBaseValue() == NFRule.DEFAULT_RULE)
{
// if the rule is a fraction rule, return an IntegralPartSubstitution
return new IntegralPartSubstitution(pos, ruleSet, description);
@@ -115,7 +115,7 @@
}
else if (rule.getBaseValue() == NFRule.IMPROPER_FRACTION_RULE
|| rule.getBaseValue() == NFRule.PROPER_FRACTION_RULE
- || rule.getBaseValue() == NFRule.PRIMARY_RULE)
+ || rule.getBaseValue() == NFRule.DEFAULT_RULE)
{
// if the rule is a fraction rule, return a
// FractionalPartSubstitution
diff --git a/icu4j/main/classes/core/src/com/ibm/icu/text/RuleBasedNumberFormat.java b/icu4j/main/classes/core/src/com/ibm/icu/text/RuleBasedNumberFormat.java
index e49595c..0e69dac 100644
--- a/icu4j/main/classes/core/src/com/ibm/icu/text/RuleBasedNumberFormat.java
+++ b/icu4j/main/classes/core/src/com/ibm/icu/text/RuleBasedNumberFormat.java
@@ -275,7 +275,7 @@
* <tr>
* <td style="width: 5%; vertical-align: top;"></td>
* <td style="width: 8%; vertical-align: top;">x.0:</td>
- * <td valign="top">The rule is a <em>primary rule</em>. If the full stop in
+ * <td valign="top">The rule is a <em>default rule</em>. If the full stop in
* the middle of the rule name is replaced with the decimal point
* that is used in the language or DecimalFormatSymbols, then that rule will
* have precedence when formatting and parsing this rule. For example, some
@@ -313,9 +313,9 @@
* algorithms: If the rule set is a regular rule set, do the following:
*
* <ul>
- * <li>If the rule set includes a primary rule (and the number was passed in as a <tt>double</tt>),
- * use the primary rule. (If the number being formatted was passed in as a <tt>long</tt>,
- * the primary rule is ignored.)</li>
+ * <li>If the rule set includes a default rule (and the number was passed in as a <tt>double</tt>),
+ * use the default rule. (If the number being formatted was passed in as a <tt>long</tt>,
+ * the default rule is ignored.)</li>
* <li>If the number is negative, use the negative-number rule.</li>
* <li>If the number has a fractional part and is greater than 1, use the improper fraction
* rule.</li>
@@ -377,7 +377,7 @@
* <tr>
* <td style="width: 37;"></td>
* <td style="width: 23;"></td>
- * <td style="width: 165; vertical-align: top;">in fraction or primary rule</td>
+ * <td style="width: 165; vertical-align: top;">in fraction or default rule</td>
* <td>Isolate the number's fractional part and format it.</td>
* </tr>
* <tr>
@@ -415,7 +415,7 @@
* <tr>
* <td style="width: 37;"></td>
* <td style="width: 23;"></td>
- * <td style="width: 165; vertical-align: top;">in fraction or primary rule</td>
+ * <td style="width: 165; vertical-align: top;">in fraction or default rule</td>
* <td>Isolate the number's integral part and format it.</td>
* </tr>
* <tr>
@@ -452,7 +452,7 @@
* <tr>
* <td style="width: 37;"></td>
* <td style="width: 23;"></td>
- * <td style="width: 165; vertical-align: top;">in primary rule</td>
+ * <td style="width: 165; vertical-align: top;">in default rule</td>
* <td>Omit the optional text if the number is an integer (same as specifying both an x.x
* rule and an x.0 rule)</td>
* </tr>
@@ -1153,7 +1153,7 @@
/**
* Formats the specified number according to the specified rule set.
- * (If the specified rule set specifies a primary ["x.0"] rule, this function
+ * (If the specified rule set specifies a default ["x.0"] rule, this function
* ignores it. Convert the number to a double first if you ned it.) This
* function preserves all the precision in the long-- it doesn't convert it
* to a double.
@@ -1199,7 +1199,7 @@
/**
* Formats the specified number using the formatter's default rule set.
* (The default rule set is the last public rule set defined in the description.)
- * (If the specified rule set specifies a primary ["x.0"] rule, this function
+ * (If the specified rule set specifies a default ["x.0"] rule, this function
* ignores it. Convert the number to a double first if you ned it.) This
* function preserves all the precision in the long-- it doesn't convert it
* to a double.