ICU-11276 Feedback from ICU-TC. Fixing doxygen warnings.
This commit is contained in:
parent
9109a388f4
commit
92a86dfcf5
@ -266,7 +266,7 @@ void LocalizedNumberRangeFormatter::formatImpl(
|
||||
return;
|
||||
}
|
||||
|
||||
results->identityType = UNUM_IDENTITY_TYPE_NOT_EQUAL;
|
||||
results->identityResult = UNUM_IDENTITY_RESULT_NOT_EQUAL;
|
||||
}
|
||||
|
||||
|
||||
@ -361,15 +361,15 @@ UnicodeString FormattedNumberRange::getSecondDecimal(UErrorCode& status) const {
|
||||
return fResults->quantity2.toScientificString();
|
||||
}
|
||||
|
||||
UNumberRangeIdentityType FormattedNumberRange::getIdentityType(UErrorCode& status) const {
|
||||
UNumberRangeIdentityResult FormattedNumberRange::getIdentityResult(UErrorCode& status) const {
|
||||
if (U_FAILURE(status)) {
|
||||
return UNUM_IDENTITY_TYPE_NOT_EQUAL;
|
||||
return UNUM_IDENTITY_RESULT_NOT_EQUAL;
|
||||
}
|
||||
if (fResults == nullptr) {
|
||||
status = fErrorCode;
|
||||
return UNUM_IDENTITY_TYPE_NOT_EQUAL;
|
||||
return UNUM_IDENTITY_RESULT_NOT_EQUAL;
|
||||
}
|
||||
return fResults->identityType;
|
||||
return fResults->identityResult;
|
||||
}
|
||||
|
||||
FormattedNumberRange::~FormattedNumberRange() {
|
||||
|
@ -36,7 +36,7 @@ struct UFormattedNumberRangeData : public UMemory {
|
||||
DecimalQuantity quantity1;
|
||||
DecimalQuantity quantity2;
|
||||
NumberStringBuilder string;
|
||||
UNumberRangeIdentityType identityType = UNUM_IDENTITY_TYPE_EQUAL_BEFORE_ROUNDING;
|
||||
UNumberRangeIdentityResult identityResult = UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING;
|
||||
|
||||
// No C conversion methods (no C API yet)
|
||||
};
|
||||
|
@ -52,6 +52,8 @@ typedef enum UNumberRangeCollapse {
|
||||
* Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none,
|
||||
* some, or all repeated pieces in a locale-sensitive way.
|
||||
*
|
||||
* The heuristics used for this option are subject to change over time.
|
||||
*
|
||||
* @draft ICU 63
|
||||
*/
|
||||
UNUM_RANGE_COLLAPSE_AUTO,
|
||||
@ -85,7 +87,6 @@ typedef enum UNumberRangeCollapse {
|
||||
* when the identity fallback is used, compare the lower and upper BigDecimals via FormattedNumber.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
typedef enum UNumberRangeIdentityFallback {
|
||||
@ -126,37 +127,33 @@ typedef enum UNumberRangeIdentityFallback {
|
||||
* were equal or not, and whether or not the identity fallback was applied.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
typedef enum UNumberRangeIdentityType {
|
||||
typedef enum UNumberRangeIdentityResult {
|
||||
/**
|
||||
* Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
UNUM_IDENTITY_TYPE_EQUAL_BEFORE_ROUNDING,
|
||||
UNUM_IDENTITY_RESULT_EQUAL_BEFORE_ROUNDING,
|
||||
|
||||
/**
|
||||
* Used to indicate that the two numbers in the range were equal, but only after rounding rules were applied.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
UNUM_IDENTITY_TYPE_EQUAL_AFTER_ROUNDING,
|
||||
UNUM_IDENTITY_RESULT_EQUAL_AFTER_ROUNDING,
|
||||
|
||||
/**
|
||||
* Used to indicate that the two numbers in the range were not equal, even after rounding rules were applied.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
UNUM_IDENTITY_TYPE_NOT_EQUAL
|
||||
} UNumberRangeIdentityType;
|
||||
UNUM_IDENTITY_RESULT_NOT_EQUAL
|
||||
} UNumberRangeIdentityResult;
|
||||
|
||||
U_NAMESPACE_BEGIN
|
||||
|
||||
@ -366,6 +363,7 @@ class U_I18N_API NumberRangeFormatterSettings {
|
||||
* <li>UNIT: "3K - 5K miles"</li>
|
||||
* <li>NONE: "3K miles - 5K miles"</li>
|
||||
* <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The default value is AUTO.
|
||||
*
|
||||
@ -398,6 +396,7 @@ class U_I18N_API NumberRangeFormatterSettings {
|
||||
* rounding was applied</li>
|
||||
* <li>APPROXIMATELY: "~5 miles"</li>
|
||||
* <li>RANGE: "5-5 miles" (with collapse=UNIT)</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The default value is APPROXIMATELY.
|
||||
*
|
||||
@ -436,10 +435,9 @@ class U_I18N_API NumberRangeFormatterSettings {
|
||||
|
||||
// NOTE: Uses default copy and move constructors.
|
||||
|
||||
protected:
|
||||
private:
|
||||
impl::RangeMacroProps fMacros;
|
||||
|
||||
private:
|
||||
// Don't construct me directly! Use (Un)LocalizedNumberFormatter.
|
||||
NumberRangeFormatterSettings() = default;
|
||||
|
||||
@ -544,6 +542,8 @@ class U_I18N_API LocalizedNumberRangeFormatter
|
||||
* The first number in the range, usually to the left in LTR locales.
|
||||
* @param second
|
||||
* The second number in the range, usually to the right in LTR locales.
|
||||
* @param status
|
||||
* Set if an error occurs while formatting.
|
||||
* @return A FormattedNumberRange object; call .toString() to get the string.
|
||||
* @draft ICU 63
|
||||
*/
|
||||
@ -589,6 +589,8 @@ class U_I18N_API LocalizedNumberRangeFormatter
|
||||
/**
|
||||
* @param results
|
||||
* The results object. This method will mutate it to save the results.
|
||||
* @param status
|
||||
* Set if an error occurs while formatting.
|
||||
* @internal
|
||||
*/
|
||||
void formatImpl(impl::UFormattedNumberRangeData* results, UErrorCode& status) const;
|
||||
@ -674,7 +676,7 @@ class U_I18N_API FormattedNumberRange : public UMemory {
|
||||
* information, use #getAllFieldPositions().
|
||||
*
|
||||
* @param fieldPosition
|
||||
* Input+output variable. See {@link FormattedNumber#nextFieldPosition(FieldPosition)}.
|
||||
* Input+output variable. See {@link FormattedNumber#nextFieldPosition}.
|
||||
* @param status
|
||||
* Set if an error occurs while populating the FieldPosition.
|
||||
* @return TRUE if a new occurrence of the field was found; FALSE otherwise.
|
||||
@ -709,7 +711,6 @@ class U_I18N_API FormattedNumberRange : public UMemory {
|
||||
*
|
||||
* @return A decimal representation of the first formatted number.
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
* @see #getSecondDecimal
|
||||
*/
|
||||
@ -726,7 +727,6 @@ class U_I18N_API FormattedNumberRange : public UMemory {
|
||||
*
|
||||
* @return A decimal representation of the second formatted number.
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
* @see #getFirstDecimal
|
||||
*/
|
||||
@ -739,10 +739,9 @@ class U_I18N_API FormattedNumberRange : public UMemory {
|
||||
*
|
||||
* @return An indication the resulting identity situation in the formatted number range.
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see UNumberRangeIdentityFallback
|
||||
*/
|
||||
UNumberRangeIdentityType getIdentityType(UErrorCode& status) const;
|
||||
UNumberRangeIdentityResult getIdentityResult(UErrorCode& status) const;
|
||||
|
||||
/**
|
||||
* Copying not supported; use move constructor instead.
|
||||
|
@ -10,7 +10,7 @@ import java.util.Arrays;
|
||||
|
||||
import com.ibm.icu.impl.number.DecimalQuantity;
|
||||
import com.ibm.icu.impl.number.NumberStringBuilder;
|
||||
import com.ibm.icu.number.NumberRangeFormatter.RangeIdentityType;
|
||||
import com.ibm.icu.number.NumberRangeFormatter.RangeIdentityResult;
|
||||
import com.ibm.icu.util.ICUUncheckedIOException;
|
||||
|
||||
/**
|
||||
@ -26,14 +26,14 @@ public class FormattedNumberRange {
|
||||
final NumberStringBuilder nsb;
|
||||
final DecimalQuantity first;
|
||||
final DecimalQuantity second;
|
||||
final RangeIdentityType identityType;
|
||||
final RangeIdentityResult identityResult;
|
||||
|
||||
FormattedNumberRange(NumberStringBuilder nsb, DecimalQuantity first, DecimalQuantity second,
|
||||
RangeIdentityType identityType) {
|
||||
RangeIdentityResult identityResult) {
|
||||
this.nsb = nsb;
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.identityType = identityType;
|
||||
this.identityResult = identityResult;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -165,8 +165,8 @@ public class FormattedNumberRange {
|
||||
* @see NumberRangeFormatter
|
||||
* @see NumberRangeFormatter.RangeIdentityFallback
|
||||
*/
|
||||
public RangeIdentityType getIdentityType() {
|
||||
return identityType;
|
||||
public RangeIdentityResult getIdentityResult() {
|
||||
return identityResult;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,7 +6,7 @@ import com.ibm.icu.impl.number.DecimalQuantity;
|
||||
import com.ibm.icu.impl.number.DecimalQuantity_DualStorageBCD;
|
||||
import com.ibm.icu.impl.number.NumberStringBuilder;
|
||||
import com.ibm.icu.impl.number.range.RangeMacroProps;
|
||||
import com.ibm.icu.number.NumberRangeFormatter.RangeIdentityType;
|
||||
import com.ibm.icu.number.NumberRangeFormatter.RangeIdentityResult;
|
||||
|
||||
/**
|
||||
* A NumberRangeFormatter that has a locale associated with it; this means .formatRange() methods are available.
|
||||
@ -104,9 +104,9 @@ public class LocalizedNumberRangeFormatter extends NumberRangeFormatterSettings<
|
||||
nsb.append(r1.nsb);
|
||||
nsb.append(" --- ", null);
|
||||
nsb.append(r2.nsb);
|
||||
RangeIdentityType identityType = equalBeforeRounding ? RangeIdentityType.EQUAL_BEFORE_ROUNDING
|
||||
: RangeIdentityType.NOT_EQUAL;
|
||||
return new FormattedNumberRange(nsb, first, second, identityType);
|
||||
RangeIdentityResult identityResult = equalBeforeRounding ? RangeIdentityResult.EQUAL_BEFORE_ROUNDING
|
||||
: RangeIdentityResult.NOT_EQUAL;
|
||||
return new FormattedNumberRange(nsb, first, second, identityResult);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -13,10 +13,13 @@ import com.ibm.icu.util.ULocale;
|
||||
* <p>
|
||||
*
|
||||
* <pre>
|
||||
* NumberRangeFormatter.with().identityFallback(RangeIdentityFallback.APPROXIMATELY_OR_SINGLE_VALUE)
|
||||
* NumberRangeFormatter.with()
|
||||
* .identityFallback(RangeIdentityFallback.APPROXIMATELY_OR_SINGLE_VALUE)
|
||||
* .numberFormatterFirst(NumberFormatter.with().unit(MeasureUnit.METER))
|
||||
* .numberFormatterSecond(NumberFormatter.with().unit(MeasureUnit.KILOMETER)).locale(ULocale.UK)
|
||||
* .formatRange(750, 1.2).toString();
|
||||
* .numberFormatterSecond(NumberFormatter.with().unit(MeasureUnit.KILOMETER))
|
||||
* .locale(ULocale.UK)
|
||||
* .formatRange(750, 1.2)
|
||||
* .toString();
|
||||
* // => "750 m - 1.2 km"
|
||||
* </pre>
|
||||
* <p>
|
||||
@ -41,6 +44,8 @@ public abstract class NumberRangeFormatter {
|
||||
/**
|
||||
* Use locale data and heuristics to determine how much of the string to collapse. Could end up collapsing none,
|
||||
* some, or all repeated pieces in a locale-sensitive way.
|
||||
* <p>
|
||||
* The heuristics used for this option are subject to change over time.
|
||||
*
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
@ -135,7 +140,7 @@ public abstract class NumberRangeFormatter {
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
* @see NumberRangeFormatter
|
||||
*/
|
||||
public static enum RangeIdentityType {
|
||||
public static enum RangeIdentityResult {
|
||||
/**
|
||||
* Used to indicate that the two numbers in the range were equal, even before any rounding rules were applied.
|
||||
*
|
||||
@ -190,6 +195,15 @@ public abstract class NumberRangeFormatter {
|
||||
return BASE.locale(locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* Call this method at the beginning of a NumberRangeFormatter fluent chain in which the locale is known at the call
|
||||
* site.
|
||||
*
|
||||
* @param locale
|
||||
* The locale from which to load formats and symbols for number range formatting.
|
||||
* @return A {@link LocalizedNumberRangeFormatter}, to be used for chaining.
|
||||
* @draft ICU 63
|
||||
*/
|
||||
public static LocalizedNumberRangeFormatter withLocale(ULocale locale) {
|
||||
return BASE.locale(locale);
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public abstract class NumberRangeFormatterSettings<T extends NumberRangeFormatte
|
||||
* <li>UNIT: "3K - 5K miles"</li>
|
||||
* <li>NONE: "3K miles - 5K miles"</li>
|
||||
* <li>AUTO: usually UNIT or NONE, depending on the locale and formatter settings</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The default value is AUTO.
|
||||
*
|
||||
@ -127,6 +128,7 @@ public abstract class NumberRangeFormatterSettings<T extends NumberRangeFormatte
|
||||
* rounding was applied</li>
|
||||
* <li>APPROXIMATELY: "~5 miles"</li>
|
||||
* <li>RANGE: "5-5 miles" (with collapse=UNIT)</li>
|
||||
* </ul>
|
||||
* <p>
|
||||
* The default value is APPROXIMATELY.
|
||||
*
|
||||
@ -195,7 +197,7 @@ public abstract class NumberRangeFormatterSettings<T extends NumberRangeFormatte
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @draft ICU 60
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
@Override
|
||||
@ -206,7 +208,7 @@ public abstract class NumberRangeFormatterSettings<T extends NumberRangeFormatte
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*
|
||||
* @draft ICU 60
|
||||
* @draft ICU 63
|
||||
* @provisional This API might change or be removed in a future release.
|
||||
*/
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user