ICU-12739 ICU4J BRS, update measurement unit constants & code

X-SVN-Rev: 39299
This commit is contained in:
Peter Edberg 2016-09-20 21:17:41 +00:00
parent e6fdb36045
commit 7827611586
2 changed files with 200 additions and 21 deletions

View File

@ -397,8 +397,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of angle: revolution
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit REVOLUTION_ANGLE = MeasureUnit.internalGetInstance("angle", "revolution");
@ -485,8 +484,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of consumption: liter-per-100kilometers
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit LITER_PER_100KILOMETERS = MeasureUnit.internalGetInstance("consumption", "liter-per-100kilometers");
@ -509,6 +507,34 @@ public class MeasureUnit implements Serializable {
*/
public static final MeasureUnit MILE_PER_GALLON_IMPERIAL = MeasureUnit.internalGetInstance("consumption", "mile-per-gallon-imperial");
/**
* Constant for unit of coordinate: east
* @draft ICU 58
* @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit EAST = MeasureUnit.internalGetInstance("coordinate", "east");
/**
* Constant for unit of coordinate: north
* @draft ICU 58
* @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit NORTH = MeasureUnit.internalGetInstance("coordinate", "north");
/**
* Constant for unit of coordinate: south
* @draft ICU 58
* @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit SOUTH = MeasureUnit.internalGetInstance("coordinate", "south");
/**
* Constant for unit of coordinate: west
* @draft ICU 58
* @provisional This API might change or be removed in a future release.
*/
public static final MeasureUnit WEST = MeasureUnit.internalGetInstance("coordinate", "west");
/**
* Constant for unit of digital: bit
* @stable ICU 54
@ -571,8 +597,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of duration: century
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit CENTURY = MeasureUnit.internalGetInstance("duration", "century");
@ -794,8 +819,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of length: mile-scandinavian
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit MILE_SCANDINAVIAN = MeasureUnit.internalGetInstance("length", "mile-scandinavian");
@ -981,8 +1005,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of speed: knot
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit KNOT = MeasureUnit.internalGetInstance("speed", "knot");
@ -1012,8 +1035,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of temperature: generic
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit GENERIC_TEMPERATURE = MeasureUnit.internalGetInstance("temperature", "generic");
@ -1091,8 +1113,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of volume: cup-metric
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit CUP_METRIC = MeasureUnit.internalGetInstance("volume", "cup-metric");
@ -1153,8 +1174,7 @@ public class MeasureUnit implements Serializable {
/**
* Constant for unit of volume: pint-metric
* @draft ICU 56
* @provisional This API might change or be removed in a future release.
* @stable ICU 56
*/
public static final MeasureUnit PINT_METRIC = MeasureUnit.internalGetInstance("volume", "pint-metric");

View File

@ -74,7 +74,7 @@ public class MeasureUnitTest extends TestFmwk {
}
}
private static final String[] DRAFT_VERSIONS = {"55", "56", "57"};
private static final String[] DRAFT_VERSIONS = {"57", "58"};
private static final HashSet<String> DRAFT_VERSION_SET = new HashSet<String>();
@ -215,6 +215,10 @@ public class MeasureUnitTest extends TestFmwk {
{"PART_PER_MILLION", "57"},
{"MILE_PER_GALLON_IMPERIAL", "57"},
{"GALLON_IMPERIAL", "57"},
{"EAST", "58"},
{"NORTH", "58"},
{"SOUTH", "58"},
{"WEST", "58"},
};
private static final HashMap<String, String> JAVA_VERSION_MAP = new HashMap<String, String>();
@ -263,10 +267,20 @@ public class MeasureUnitTest extends TestFmwk {
// new MeasureUnitTest().run(args);
// }
//public void testZZZ() {
// // various generateXXX calls go here, see
// // http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
//}
/*
@Test
public void testZZZ() {
// various generateXXX calls go here, see
// http://site.icu-project.org/design/formatting/measureformat/updating-measure-unit
// use this test to run each of the ollowing in succession
//generateConstants("58"); // for MeasureUnit.java, update generated MeasureUnit constants
//generateBackwardCompatibilityTest("58.1"); // for MeasureUnitTest.java, create TestCompatible58_1
//generateCXXHConstants("58"); // for measunit.h, update generated createXXX methods
//generateCXXConstants(); // for measunit.cpp, update generated code
//generateCXXBackwardCompatibilityTest("58.1"); // for measfmttest.cpp, create TestCompatible58_1
updateJAVAVersions("58"); // for MeasureUnitTest.java, JAVA_VERSIONS
}
*/
@Test
public void TestCompatible53_1() {
@ -855,6 +869,151 @@ public class MeasureUnitTest extends TestFmwk {
assertEquals("", 134, units.length);
}
@Test
public void TestCompatible58_1() {
MeasureUnit[] units = {
MeasureUnit.G_FORCE,
MeasureUnit.METER_PER_SECOND_SQUARED,
MeasureUnit.ARC_MINUTE,
MeasureUnit.ARC_SECOND,
MeasureUnit.DEGREE,
MeasureUnit.RADIAN,
MeasureUnit.REVOLUTION_ANGLE,
MeasureUnit.ACRE,
MeasureUnit.HECTARE,
MeasureUnit.SQUARE_CENTIMETER,
MeasureUnit.SQUARE_FOOT,
MeasureUnit.SQUARE_INCH,
MeasureUnit.SQUARE_KILOMETER,
MeasureUnit.SQUARE_METER,
MeasureUnit.SQUARE_MILE,
MeasureUnit.SQUARE_YARD,
MeasureUnit.KARAT,
MeasureUnit.MILLIGRAM_PER_DECILITER,
MeasureUnit.MILLIMOLE_PER_LITER,
MeasureUnit.PART_PER_MILLION,
MeasureUnit.LITER_PER_100KILOMETERS,
MeasureUnit.LITER_PER_KILOMETER,
MeasureUnit.MILE_PER_GALLON,
MeasureUnit.MILE_PER_GALLON_IMPERIAL,
MeasureUnit.EAST,
MeasureUnit.NORTH,
MeasureUnit.SOUTH,
MeasureUnit.WEST,
MeasureUnit.BIT,
MeasureUnit.BYTE,
MeasureUnit.GIGABIT,
MeasureUnit.GIGABYTE,
MeasureUnit.KILOBIT,
MeasureUnit.KILOBYTE,
MeasureUnit.MEGABIT,
MeasureUnit.MEGABYTE,
MeasureUnit.TERABIT,
MeasureUnit.TERABYTE,
MeasureUnit.CENTURY,
MeasureUnit.DAY,
MeasureUnit.HOUR,
MeasureUnit.MICROSECOND,
MeasureUnit.MILLISECOND,
MeasureUnit.MINUTE,
MeasureUnit.MONTH,
MeasureUnit.NANOSECOND,
MeasureUnit.SECOND,
MeasureUnit.WEEK,
MeasureUnit.YEAR,
MeasureUnit.AMPERE,
MeasureUnit.MILLIAMPERE,
MeasureUnit.OHM,
MeasureUnit.VOLT,
MeasureUnit.CALORIE,
MeasureUnit.FOODCALORIE,
MeasureUnit.JOULE,
MeasureUnit.KILOCALORIE,
MeasureUnit.KILOJOULE,
MeasureUnit.KILOWATT_HOUR,
MeasureUnit.GIGAHERTZ,
MeasureUnit.HERTZ,
MeasureUnit.KILOHERTZ,
MeasureUnit.MEGAHERTZ,
MeasureUnit.ASTRONOMICAL_UNIT,
MeasureUnit.CENTIMETER,
MeasureUnit.DECIMETER,
MeasureUnit.FATHOM,
MeasureUnit.FOOT,
MeasureUnit.FURLONG,
MeasureUnit.INCH,
MeasureUnit.KILOMETER,
MeasureUnit.LIGHT_YEAR,
MeasureUnit.METER,
MeasureUnit.MICROMETER,
MeasureUnit.MILE,
MeasureUnit.MILE_SCANDINAVIAN,
MeasureUnit.MILLIMETER,
MeasureUnit.NANOMETER,
MeasureUnit.NAUTICAL_MILE,
MeasureUnit.PARSEC,
MeasureUnit.PICOMETER,
MeasureUnit.YARD,
MeasureUnit.LUX,
MeasureUnit.CARAT,
MeasureUnit.GRAM,
MeasureUnit.KILOGRAM,
MeasureUnit.METRIC_TON,
MeasureUnit.MICROGRAM,
MeasureUnit.MILLIGRAM,
MeasureUnit.OUNCE,
MeasureUnit.OUNCE_TROY,
MeasureUnit.POUND,
MeasureUnit.STONE,
MeasureUnit.TON,
MeasureUnit.GIGAWATT,
MeasureUnit.HORSEPOWER,
MeasureUnit.KILOWATT,
MeasureUnit.MEGAWATT,
MeasureUnit.MILLIWATT,
MeasureUnit.WATT,
MeasureUnit.HECTOPASCAL,
MeasureUnit.INCH_HG,
MeasureUnit.MILLIBAR,
MeasureUnit.MILLIMETER_OF_MERCURY,
MeasureUnit.POUND_PER_SQUARE_INCH,
MeasureUnit.KILOMETER_PER_HOUR,
MeasureUnit.KNOT,
MeasureUnit.METER_PER_SECOND,
MeasureUnit.MILE_PER_HOUR,
MeasureUnit.CELSIUS,
MeasureUnit.FAHRENHEIT,
MeasureUnit.GENERIC_TEMPERATURE,
MeasureUnit.KELVIN,
MeasureUnit.ACRE_FOOT,
MeasureUnit.BUSHEL,
MeasureUnit.CENTILITER,
MeasureUnit.CUBIC_CENTIMETER,
MeasureUnit.CUBIC_FOOT,
MeasureUnit.CUBIC_INCH,
MeasureUnit.CUBIC_KILOMETER,
MeasureUnit.CUBIC_METER,
MeasureUnit.CUBIC_MILE,
MeasureUnit.CUBIC_YARD,
MeasureUnit.CUP,
MeasureUnit.CUP_METRIC,
MeasureUnit.DECILITER,
MeasureUnit.FLUID_OUNCE,
MeasureUnit.GALLON,
MeasureUnit.GALLON_IMPERIAL,
MeasureUnit.HECTOLITER,
MeasureUnit.LITER,
MeasureUnit.MEGALITER,
MeasureUnit.MILLILITER,
MeasureUnit.PINT,
MeasureUnit.PINT_METRIC,
MeasureUnit.QUART,
MeasureUnit.TABLESPOON,
MeasureUnit.TEASPOON,
};
assertEquals("", 138, units.length);
}
@Test
public void TestExamplesInDocs() {
MeasureFormat fmtFr = MeasureFormat.getInstance(