mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-08 06:53:45 +00:00
parent
61f0e16b11
commit
54e7bace04
13 changed files with 103 additions and 88 deletions
|
@ -96,8 +96,8 @@ public class ConversionRates {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param singleUnit
|
||||
* @return The bese units in the `SingleUnitImpl` with applying the dimensionality only and not the SI prefix.
|
||||
* @param singleUnit An instance of SingleUnitImpl.
|
||||
* @return The base units in the `SingleUnitImpl` with applying the dimensionality only and not the SI prefix.
|
||||
* <p>
|
||||
* NOTE:
|
||||
* This method is helpful when checking the convertibility because no need to check convertibility.
|
||||
|
@ -184,6 +184,7 @@ public class ConversionRates {
|
|||
|
||||
public static class ConversionRateInfo {
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private final String simpleUnit;
|
||||
private final String target;
|
||||
private final String conversionRate;
|
||||
|
|
|
@ -51,7 +51,7 @@ public class MeasureUnitImpl {
|
|||
*
|
||||
* @param identifier The unit identifier string.
|
||||
* @return A newly parsed object.
|
||||
* @throws <code>IllegalArgumentException</code> in case of incorrect/non-parsed identifier.
|
||||
* @throws IllegalArgumentException in case of incorrect/non-parsed identifier.
|
||||
*/
|
||||
public static MeasureUnitImpl forIdentifier(String identifier) {
|
||||
return UnitsParser.parseForIdentifier(identifier);
|
||||
|
@ -66,11 +66,11 @@ public class MeasureUnitImpl {
|
|||
return result;
|
||||
}
|
||||
|
||||
public MeasureUnitImpl clone() {
|
||||
public MeasureUnitImpl copy() {
|
||||
MeasureUnitImpl result = new MeasureUnitImpl();
|
||||
result.complexity = this.complexity;
|
||||
result.identifier = this.identifier;
|
||||
result.singleUnits = (ArrayList<SingleUnitImpl>) this.singleUnits.clone();
|
||||
result.singleUnits = new ArrayList<>(this.singleUnits);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -103,7 +103,7 @@ public class MeasureUnitImpl {
|
|||
* @return a list of <code>MeasureUnitImpl</code>
|
||||
*/
|
||||
public ArrayList<MeasureUnitImpl> extractIndividualUnits() {
|
||||
ArrayList<MeasureUnitImpl> result = new ArrayList<MeasureUnitImpl>();
|
||||
ArrayList<MeasureUnitImpl> result = new ArrayList<>();
|
||||
if (this.getComplexity() == MeasureUnit.Complexity.MIXED) {
|
||||
// In case of mixed units, each single unit can be considered as a stand alone MeasureUnitImpl.
|
||||
for (SingleUnitImpl singleUnit :
|
||||
|
@ -114,7 +114,7 @@ public class MeasureUnitImpl {
|
|||
return result;
|
||||
}
|
||||
|
||||
result.add(this.clone());
|
||||
result.add(this.copy());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class MeasureUnitImpl {
|
|||
}
|
||||
|
||||
// Add a copy of singleUnit
|
||||
this.singleUnits.add(singleUnit.clone());
|
||||
this.singleUnits.add(singleUnit.copy());
|
||||
|
||||
// If the MeasureUnitImpl is `UMEASURE_UNIT_SINGLE` and after the appending a unit, the singleUnits are more
|
||||
// than one singleUnit. thus means the complexity should be `UMEASURE_UNIT_COMPOUND`
|
||||
|
@ -191,7 +191,7 @@ public class MeasureUnitImpl {
|
|||
return new SingleUnitImpl();
|
||||
}
|
||||
if (this.singleUnits.size() == 1) {
|
||||
return this.singleUnits.get(0).clone();
|
||||
return this.singleUnits.get(0).copy();
|
||||
}
|
||||
|
||||
throw new UnsupportedOperationException();
|
||||
|
|
|
@ -33,7 +33,7 @@ public class SingleUnitImpl {
|
|||
*/
|
||||
private MeasureUnit.SIPrefix siPrefix = MeasureUnit.SIPrefix.ONE;
|
||||
|
||||
public SingleUnitImpl clone() {
|
||||
public SingleUnitImpl copy() {
|
||||
SingleUnitImpl result = new SingleUnitImpl();
|
||||
result.index = this.index;
|
||||
result.dimensionality = this.dimensionality;
|
||||
|
@ -50,8 +50,6 @@ public class SingleUnitImpl {
|
|||
|
||||
/**
|
||||
* Generates an neutral identifier string for a single unit which means we do not include the dimension signal.
|
||||
*
|
||||
* @throws IllegalArgumentException
|
||||
*/
|
||||
public String getNeutralIdentifier() {
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
@ -70,6 +68,7 @@ public class SingleUnitImpl {
|
|||
result.append(posPower);
|
||||
result.append('-');
|
||||
} else {
|
||||
// TODO: IllegalArgumentException might not be appropriate here
|
||||
throw new IllegalArgumentException("Unit Identifier Syntax Error");
|
||||
}
|
||||
|
||||
|
|
|
@ -155,6 +155,7 @@ public class UnitConverter {
|
|||
/**
|
||||
* Clone this <code>Factor</code>.
|
||||
*/
|
||||
@Override
|
||||
protected Factor clone() {
|
||||
Factor result = new Factor();
|
||||
result.factorNum = this.factorNum;
|
||||
|
@ -172,8 +173,6 @@ public class UnitConverter {
|
|||
|
||||
/**
|
||||
* Returns a single `BigDecimal` that represent the conversion rate after substituting all the constants.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public BigDecimal getConversionRate() {
|
||||
Factor resultCollector = this.clone();
|
||||
|
|
|
@ -55,7 +55,7 @@ public class UnitsData {
|
|||
}
|
||||
|
||||
/**
|
||||
* @param measureUnit
|
||||
* @param measureUnit An instance of MeasureUnitImpl.
|
||||
* @return the corresponding category.
|
||||
*/
|
||||
public String getCategory(MeasureUnitImpl measureUnit) {
|
||||
|
|
|
@ -62,7 +62,7 @@ import com.ibm.icu.util.ULocale.Category;
|
|||
* <p>
|
||||
* This class should not be subclassed.</p>
|
||||
* <p>
|
||||
* HebrewCalendar usually should be instantiated using
|
||||
* HebrewCalendar usually should be instantiated using
|
||||
* {@link com.ibm.icu.util.Calendar#getInstance(ULocale)} passing in a <code>ULocale</code>
|
||||
* with the tag <code>"@calendar=hebrew"</code>.</p>
|
||||
*
|
||||
|
@ -82,33 +82,33 @@ public class HebrewCalendar extends Calendar {
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
|
||||
/**
|
||||
* Constant for Tishri, the 1st month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
/**
|
||||
* Constant for Tishri, the 1st month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int TISHRI = 0;
|
||||
|
||||
/**
|
||||
* Constant for Heshvan, the 2nd month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Heshvan, the 2nd month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int HESHVAN = 1;
|
||||
|
||||
/**
|
||||
* Constant for Kislev, the 3rd month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Kislev, the 3rd month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int KISLEV = 2;
|
||||
|
||||
/**
|
||||
* Constant for Tevet, the 4th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Tevet, the 4th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int TEVET = 3;
|
||||
|
||||
/**
|
||||
* Constant for Shevat, the 5th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Shevat, the 5th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int SHEVAT = 4;
|
||||
|
||||
|
@ -120,45 +120,45 @@ public class HebrewCalendar extends Calendar {
|
|||
*/
|
||||
public static final int ADAR_1 = 5;
|
||||
|
||||
/**
|
||||
* Constant for the Adar, the 7th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
/**
|
||||
* Constant for the Adar, the 7th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int ADAR = 6;
|
||||
|
||||
/**
|
||||
* Constant for Nisan, the 8th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Nisan, the 8th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int NISAN = 7;
|
||||
|
||||
/**
|
||||
* Constant for Iyar, the 9th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Iyar, the 9th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int IYAR = 8;
|
||||
|
||||
/**
|
||||
* Constant for Sivan, the 10th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Sivan, the 10th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int SIVAN = 9;
|
||||
|
||||
/**
|
||||
* Constant for Tammuz, the 11th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Tammuz, the 11th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int TAMUZ = 10;
|
||||
|
||||
/**
|
||||
* Constant for Av, the 12th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Av, the 12th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int AV = 11;
|
||||
|
||||
/**
|
||||
* Constant for Elul, the 13th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
* Constant for Elul, the 13th month of the Hebrew year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
public static final int ELUL = 12;
|
||||
|
||||
|
@ -270,7 +270,7 @@ public class HebrewCalendar extends Calendar {
|
|||
//-------------------------------------------------------------------------
|
||||
|
||||
private static CalendarCache cache = new CalendarCache();
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
// Constructors...
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -421,7 +421,7 @@ public class HebrewCalendar extends Calendar {
|
|||
/**
|
||||
* Add a signed amount to a specified field, using this calendar's rules.
|
||||
* For example, to add three days to the current date, you can call
|
||||
* <code>add(Calendar.DATE, 3)</code>.
|
||||
* <code>add(Calendar.DATE, 3)</code>.
|
||||
* <p>
|
||||
* When adding to certain fields, the values of other fields may conflict and
|
||||
* need to be changed. For example, when adding one to the {@link #MONTH MONTH} field
|
||||
|
@ -445,10 +445,11 @@ public class HebrewCalendar extends Calendar {
|
|||
* to a field that cannot be handled by this method.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
public void add(int field, int amount)
|
||||
{
|
||||
switch (field) {
|
||||
case MONTH:
|
||||
case MONTH:
|
||||
{
|
||||
// We can't just do a set(MONTH, get(MONTH) + amount). The
|
||||
// reason is ADAR_1. Suppose amount is +2 and we land in
|
||||
|
@ -492,7 +493,7 @@ public class HebrewCalendar extends Calendar {
|
|||
pinField(DAY_OF_MONTH);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
super.add(field, amount);
|
||||
break;
|
||||
|
@ -504,7 +505,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* example, to roll the current date up by three days, you can call
|
||||
* <code>roll(Calendar.DATE, 3)</code>. If the
|
||||
* field is rolled past its maximum allowable value, it will "wrap" back
|
||||
* to its minimum and continue rolling.
|
||||
* to its minimum and continue rolling.
|
||||
* For example, calling <code>roll(Calendar.DATE, 10)</code>
|
||||
* on a Hebrew calendar set to "25 Av 5758" will result in the date "5 Av 5758".
|
||||
* <p>
|
||||
|
@ -531,6 +532,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* to a field that cannot be handled by this method.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
public void roll(int field, int amount)
|
||||
{
|
||||
switch (field) {
|
||||
|
@ -538,7 +540,7 @@ public class HebrewCalendar extends Calendar {
|
|||
{
|
||||
int month = get(MONTH);
|
||||
int year = get(YEAR);
|
||||
|
||||
|
||||
boolean leapYear = isLeapYear(year);
|
||||
int yearLength = monthsInYear(year);
|
||||
int newMonth = month + (amount % yearLength);
|
||||
|
@ -570,14 +572,14 @@ public class HebrewCalendar extends Calendar {
|
|||
// "parts" (or halakim), which are 1/1080 of an hour, or 3 1/3 seconds.
|
||||
private static final long HOUR_PARTS = 1080;
|
||||
private static final long DAY_PARTS = 24*HOUR_PARTS;
|
||||
|
||||
|
||||
// An approximate value for the length of a lunar month.
|
||||
// It is used to calculate the approximate year and month of a given
|
||||
// absolute date.
|
||||
static private final int MONTH_DAYS = 29;
|
||||
static private final long MONTH_FRACT = 12*HOUR_PARTS + 793;
|
||||
static private final long MONTH_PARTS = MONTH_DAYS*DAY_PARTS + MONTH_FRACT;
|
||||
|
||||
|
||||
// The time of the new moon (in parts) on 1 Tishri, year 1 (the epoch)
|
||||
// counting from noon on the day before. BAHARAD is an abbreviation of
|
||||
// Bet (Monday), Hey (5 hours from sunset), Resh-Daled (204).
|
||||
|
@ -606,10 +608,10 @@ public class HebrewCalendar extends Calendar {
|
|||
private static long startOfYear(int year)
|
||||
{
|
||||
long day = cache.get(year);
|
||||
|
||||
|
||||
if (day == CalendarCache.EMPTY) {
|
||||
// # of months before year
|
||||
int months = (int)floorDivide((235 * (long)year - 234), (long)19);
|
||||
int months = (int)floorDivide((235 * (long)year - 234), 19);
|
||||
|
||||
long frac = months * MONTH_FRACT + BAHARAD; // Fractional part of day #
|
||||
day = months * 29 + (frac / DAY_PARTS); // Whole # part of calculation
|
||||
|
@ -707,6 +709,7 @@ public class HebrewCalendar extends Calendar {
|
|||
/**
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected int handleGetLimit(int field, int limitType) {
|
||||
return LIMITS[field][limitType];
|
||||
}
|
||||
|
@ -715,6 +718,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* Returns the length of the given month in the given year
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected int handleGetMonthLength(int extendedYear, int month) {
|
||||
// Resolve out-of-range months. This is necessary in order to
|
||||
// obtain the correct year. We correct to
|
||||
|
@ -735,7 +739,7 @@ public class HebrewCalendar extends Calendar {
|
|||
case KISLEV:
|
||||
// These two month lengths can vary
|
||||
return MONTH_LENGTH[month][yearType(extendedYear)];
|
||||
|
||||
|
||||
default:
|
||||
// The rest are a fixed length
|
||||
return MONTH_LENGTH[month][0];
|
||||
|
@ -746,6 +750,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* Returns the number of days in the given Hebrew year
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected int handleGetYearLength(int eyear) {
|
||||
return (int)(startOfYear(eyear+1) - startOfYear(eyear));
|
||||
}
|
||||
|
@ -758,6 +763,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* @internal
|
||||
* @deprecated This API is ICU internal only.
|
||||
*/
|
||||
@Override
|
||||
@Deprecated
|
||||
protected void validateField(int field) {
|
||||
if (field == MONTH && !isLeapYear(handleGetExtendedYear()) && internalGet(MONTH) == ADAR_1) {
|
||||
|
@ -781,7 +787,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* <li>DAY_OF_MONTH
|
||||
* <li>DAY_OF_YEAR
|
||||
* <li>EXTENDED_YEAR</ul>
|
||||
*
|
||||
*
|
||||
* Subclasses can refer to the DAY_OF_WEEK and DOW_LOCAL fields,
|
||||
* which will be set when this method is called. Subclasses can
|
||||
* also call the getGregorianXxx() methods to obtain Gregorian
|
||||
|
@ -792,10 +798,11 @@ public class HebrewCalendar extends Calendar {
|
|||
* getFieldCount() - 1.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected void handleComputeFields(int julianDay) {
|
||||
long d = julianDay - 347997;
|
||||
long m = floorDivide((d * (long)DAY_PARTS), (long)MONTH_PARTS); // Months (approx)
|
||||
int year = (int)(floorDivide((19 * m + 234), (long)235) + 1); // Years (approx)
|
||||
long m = floorDivide((d * DAY_PARTS), MONTH_PARTS); // Months (approx)
|
||||
int year = (int)(floorDivide((19 * m + 234), 235) + 1); // Years (approx)
|
||||
long ys = startOfYear(year); // 1st day of year
|
||||
int dayOfYear = (int)(d - ys);
|
||||
|
||||
|
@ -822,7 +829,7 @@ public class HebrewCalendar extends Calendar {
|
|||
internalSet(EXTENDED_YEAR, year);
|
||||
internalSet(MONTH, month);
|
||||
internalSet(DAY_OF_MONTH, dayOfMonth);
|
||||
internalSet(DAY_OF_YEAR, dayOfYear);
|
||||
internalSet(DAY_OF_YEAR, dayOfYear);
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -832,6 +839,7 @@ public class HebrewCalendar extends Calendar {
|
|||
/**
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected int handleGetExtendedYear() {
|
||||
int year;
|
||||
if (newerField(EXTENDED_YEAR, YEAR) == EXTENDED_YEAR) {
|
||||
|
@ -846,6 +854,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* Return JD of start of given month/year.
|
||||
* @stable ICU 2.8
|
||||
*/
|
||||
@Override
|
||||
protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
|
||||
|
||||
// Resolve out-of-range months. This is necessary in order to
|
||||
|
@ -879,6 +888,7 @@ public class HebrewCalendar extends Calendar {
|
|||
* {@inheritDoc}
|
||||
* @stable ICU 3.8
|
||||
*/
|
||||
@Override
|
||||
public String getType() {
|
||||
return "hebrew";
|
||||
}
|
||||
|
|
|
@ -358,7 +358,6 @@ public class MeasureUnit implements Serializable {
|
|||
|
||||
/**
|
||||
* @internal
|
||||
* @param measureUnitImpl
|
||||
* @deprecated Internal API for ICU use only.
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -376,7 +375,7 @@ public class MeasureUnit implements Serializable {
|
|||
private MeasureUnit(MeasureUnitImpl measureUnitImpl) {
|
||||
type = null;
|
||||
subType = null;
|
||||
this.measureUnitImpl = measureUnitImpl.clone();
|
||||
this.measureUnitImpl = measureUnitImpl.copy();
|
||||
}
|
||||
|
||||
|
||||
|
@ -2056,7 +2055,7 @@ public class MeasureUnit implements Serializable {
|
|||
private MeasureUnitImpl getCopyOfMeasureUnitImpl() {
|
||||
return this.measureUnitImpl == null ?
|
||||
MeasureUnitImpl.forIdentifier(getIdentifier()) :
|
||||
this.measureUnitImpl.clone();
|
||||
this.measureUnitImpl.copy();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1628,7 +1628,6 @@ public final class ULocale implements Serializable, Comparable<ULocale> {
|
|||
}
|
||||
}
|
||||
|
||||
boolean knownCanonicalized = false;
|
||||
String name = parser.getName();
|
||||
if (!isKnownCanonicalizedLocale(name)) {
|
||||
AliasReplacer replacer = new AliasReplacer(
|
||||
|
|
|
@ -234,10 +234,10 @@ public class JapaneseTest extends CalendarTestFmwk {
|
|||
|
||||
@Test
|
||||
public void TestForceGannenNumbering() {
|
||||
final String jCalShortPattern = "y/M/d"; // Note: just 'y' doesn't work here.
|
||||
final String jCalGannenDate = "1/5/9"; // A date in the above format after the accession date for Heisei [1989-] era (Heisei year 1 Jan 8)
|
||||
// or Reiwa [2019-] era (Reiwa year 1 May 1). If before the accession date,
|
||||
// the year will be in the previous era.
|
||||
// final String jCalShortPattern = "y/M/d"; // Note: just 'y' doesn't work here.
|
||||
// final String jCalGannenDate = "1/5/9"; // A date in the above format after the accession date for Heisei [1989-] era (Heisei year 1 Jan 8)
|
||||
// // or Reiwa [2019-] era (Reiwa year 1 May 1). If before the accession date,
|
||||
// // the year will be in the previous era.
|
||||
ULocale loc = new ULocale("ja_JP@calendar=japanese");
|
||||
Date refDate = new Date(600336000000L); // 1989 Jan 9 Monday = Heisei 1
|
||||
final String patText = "Gy年M月d日";
|
||||
|
|
|
@ -732,7 +732,7 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
// Note that from_data/to_data are specified using era names from root, for the calendar specified by locale.
|
||||
String[] DATA = {
|
||||
"GGGGG y MM dd HH:mm:ss", // pattern for from_data/to_data
|
||||
|
||||
|
||||
// This test is for tickets ICU-21154, ICU-21155, and ICU-21156 and is intended to verify
|
||||
// that all of the special skeleton characters for hours and day periods work as expected
|
||||
// with date intervals:
|
||||
|
@ -748,7 +748,7 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
// baseline (h and H)
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "hh", "12 \\u2013 1 AM",
|
||||
"de", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "HH", "00\\u201301 Uhr",
|
||||
|
||||
|
||||
// k and K (ICU-21154 and ICU-21156)
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "KK", "0 \\u2013 1 AM",
|
||||
"de", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "kk", "24\\u201301 Uhr",
|
||||
|
@ -758,7 +758,7 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "ha", "12 \\u2013 1 AM",
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 12:00:00", "haaaaa", "10 a \\u2013 12 p",
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "haaaaa", "12 \\u2013 1 a",
|
||||
|
||||
|
||||
// j (ICU-21155)
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "jj", "10 AM \\u2013 1 PM",
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "jj", "12 \\u2013 1 AM",
|
||||
|
@ -768,20 +768,20 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
"de", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "jj", "00\\u201301 Uhr",
|
||||
"de", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "jjjjj", "10\\u201313 Uhr",
|
||||
"de", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "jjjjj", "00\\u201301 Uhr",
|
||||
|
||||
|
||||
// b and B
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 12:00:00", "hb", "10 AM \\u2013 12 noon",
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 12:00:00", "hbbbbb", "10 a \\u2013 12 n",
|
||||
"en", "CE 2010 09 27 13:00:00", "CE 2010 09 27 14:00:00", "hb", "1 \\u2013 2 PM",
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "hB", "10 in the morning \\u2013 1 in the afternoon",
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "hB", "12 \\u2013 1 at night",
|
||||
|
||||
|
||||
// J
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "J", "10 \\u2013 1",
|
||||
"en", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "J", "12 \\u2013 1",
|
||||
"de", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "J", "10\\u201313 Uhr",
|
||||
"de", "CE 2010 09 27 00:00:00", "CE 2010 09 27 01:00:00", "J", "00\\u201301 Uhr",
|
||||
|
||||
|
||||
// C
|
||||
// (for English and German, C should do the same thing as j)
|
||||
"en", "CE 2010 09 27 10:00:00", "CE 2010 09 27 13:00:00", "CC", "10 AM \\u2013 1 PM",
|
||||
|
@ -2187,6 +2187,7 @@ public class DateIntervalFormatTest extends TestFmwk {
|
|||
ULocale.AvailableType.WITH_LEGACY_ALIASES)) {
|
||||
// Only test 1/5 of the locale in quick mode.
|
||||
if (quick && (count++ % 5 > 0)) continue;
|
||||
@SuppressWarnings("unused")
|
||||
DateIntervalFormat fmt = DateIntervalFormat.getInstance("dMMMMy", locale);
|
||||
for (String calendar : Calendar.getKeywordValuesForLocale(
|
||||
"calendar", locale, false)) {
|
||||
|
|
|
@ -241,13 +241,14 @@ public class UnitsTest {
|
|||
}
|
||||
|
||||
String codePage = "UTF-8";
|
||||
BufferedReader f = TestUtil.getDataReader("cldr/units/unitsTest.txt", codePage);
|
||||
ArrayList<TestCase> tests = new ArrayList<>();
|
||||
while (true) {
|
||||
String line = f.readLine();
|
||||
if (line == null) break;
|
||||
if (line.isEmpty() || line.startsWith("#")) continue;
|
||||
tests.add(new TestCase(line));
|
||||
try (BufferedReader f = TestUtil.getDataReader("cldr/units/unitsTest.txt", codePage)) {
|
||||
while (true) {
|
||||
String line = f.readLine();
|
||||
if (line == null) break;
|
||||
if (line.isEmpty() || line.startsWith("#")) continue;
|
||||
tests.add(new TestCase(line));
|
||||
}
|
||||
}
|
||||
|
||||
ConversionRates conversionRates = new ConversionRates();
|
||||
|
@ -297,6 +298,7 @@ public class UnitsTest {
|
|||
/**
|
||||
* Test Case Data
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
String category;
|
||||
String usage;
|
||||
String region;
|
||||
|
@ -349,13 +351,15 @@ public class UnitsTest {
|
|||
|
||||
// Read Test data from the unitPreferencesTest
|
||||
String codePage = "UTF-8";
|
||||
BufferedReader f = TestUtil.getDataReader("cldr/units/unitPreferencesTest.txt", codePage);
|
||||
ArrayList<TestCase> tests = new ArrayList<>();
|
||||
while (true) {
|
||||
String line = f.readLine();
|
||||
if (line == null) break;
|
||||
if (line.isEmpty() || line.startsWith("#")) continue;
|
||||
tests.add(new TestCase(line));
|
||||
|
||||
try (BufferedReader f = TestUtil.getDataReader("cldr/units/unitPreferencesTest.txt", codePage)) {
|
||||
while (true) {
|
||||
String line = f.readLine();
|
||||
if (line == null) break;
|
||||
if (line.isEmpty() || line.startsWith("#")) continue;
|
||||
tests.add(new TestCase(line));
|
||||
}
|
||||
}
|
||||
|
||||
for (TestCase testCase :
|
||||
|
|
|
@ -326,11 +326,11 @@ public class NumberSkeletonTest {
|
|||
{ "scientific/*ee", "scientific/+ee" },
|
||||
{ "integer-width/*00", "integer-width/+00" },
|
||||
};
|
||||
|
||||
|
||||
for (String[] cas : cases) {
|
||||
String star = cas[0];
|
||||
String plus = cas[1];
|
||||
|
||||
|
||||
String normalized = NumberFormatter.forSkeleton(plus)
|
||||
.toSkeleton();
|
||||
assertEquals("Plus should normalize to star", star, normalized);
|
||||
|
@ -404,6 +404,7 @@ public class NumberSkeletonTest {
|
|||
String skeleton = "measure-unit/";
|
||||
skeleton += cas1[0] + "-" + cas1[1] + " per-measure-unit/" + cas2[0] + "-" + cas2[1];
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
String actual = NumberFormatter.forSkeleton(skeleton).locale(arabic).format(5142.3)
|
||||
.toString();
|
||||
// Just make sure it won't throw exception
|
||||
|
|
|
@ -1895,6 +1895,7 @@ public class RBBITestMonkey extends TestFmwk {
|
|||
|
||||
// Helper function for formatting error output.
|
||||
// Display a code point in "\\uxxxx" or "\Uxxxxxxxx" format
|
||||
@SuppressWarnings("unused")
|
||||
private static void appendCharToBuf(StringBuffer dest, int c, int fieldLen) {
|
||||
String hexChars = "0123456789abcdef";
|
||||
if (c < 0x10000) {
|
||||
|
@ -1927,6 +1928,7 @@ public class RBBITestMonkey extends TestFmwk {
|
|||
StringBuffer testText = new StringBuffer();
|
||||
int numCharClasses;
|
||||
List chClasses;
|
||||
@SuppressWarnings("unused")
|
||||
int expectedCount = 0;
|
||||
boolean[] expectedBreaks = new boolean[TESTSTRINGLEN*2 + 1];
|
||||
boolean[] forwardBreaks = new boolean[TESTSTRINGLEN*2 + 1];
|
||||
|
@ -2201,13 +2203,13 @@ public class RBBITestMonkey extends TestFmwk {
|
|||
|
||||
// BMP or SMP character in hex
|
||||
if (c >= 0x10000) {
|
||||
buffer.append("\\U").append(String.format("%08x", (int) c));
|
||||
buffer.append("\\U").append(String.format("%08x", c));
|
||||
} else {
|
||||
buffer.append(" \\u").append(String.format("%04x", (int) c));
|
||||
buffer.append(" \\u").append(String.format("%04x", c));
|
||||
}
|
||||
|
||||
buffer.append(
|
||||
String.format(String.format(" %%-%ds", (int) classNameSize),
|
||||
String.format(String.format(" %%-%ds", classNameSize),
|
||||
mk.classNameFromCodepoint(c)))
|
||||
.append(String.format(" %-40s", mk.getAppliedRule(ci)))
|
||||
.append(String.format(" %-40s\n", UCharacter.getExtendedName(c)));
|
||||
|
|
Loading…
Add table
Reference in a new issue