Class MeasureUnit
- java.lang.Object
-
- com.ibm.icu.util.MeasureUnit
-
- All Implemented Interfaces:
java.io.Serializable
public class MeasureUnit extends java.lang.Object implements java.io.SerializableA unit such as length, mass, volume, currency, etc. A unit is coupled with a numeric amount to produce a Measure. MeasureUnit objects are immutable. All subclasses must guarantee that. (However, subclassing is discouraged.)- Author:
- Alan Liu
- See Also:
Measure, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMeasureUnit.ComplexityEnumeration for unit complexity.protected static interfaceMeasureUnit.FactoryDeprecated.This API is ICU internal only.static classMeasureUnit.MeasurePrefixEnumeration for SI and binary prefixes, e.g.
-
Field Summary
Fields Modifier and Type Field Description static MeasureUnitACREConstant for unit of area: acrestatic MeasureUnitACRE_FOOTConstant for unit of volume: acre-footstatic MeasureUnitAMPEREConstant for unit of electric: amperestatic MeasureUnitARC_MINUTEConstant for unit of angle: arc-minutestatic MeasureUnitARC_SECONDConstant for unit of angle: arc-secondstatic MeasureUnitASTRONOMICAL_UNITConstant for unit of length: astronomical-unitstatic MeasureUnitATMOSPHEREConstant for unit of pressure: atmospherestatic MeasureUnitBARConstant for unit of pressure: barstatic MeasureUnitBARRELConstant for unit of volume: barrelstatic MeasureUnitBITConstant for unit of digital: bitstatic MeasureUnitBRITISH_THERMAL_UNITConstant for unit of energy: british-thermal-unitstatic MeasureUnitBUSHELConstant for unit of volume: bushelstatic MeasureUnitBYTEConstant for unit of digital: bytestatic MeasureUnitCALORIEConstant for unit of energy: caloriestatic MeasureUnitCANDELAConstant for unit of light: candelastatic MeasureUnitCARATConstant for unit of mass: caratstatic MeasureUnitCELSIUSConstant for unit of temperature: celsiusstatic MeasureUnitCENTILITERConstant for unit of volume: centiliterstatic MeasureUnitCENTIMETERConstant for unit of length: centimeterstatic MeasureUnitCENTURYConstant for unit of duration: centurystatic MeasureUnitCUBIC_CENTIMETERConstant for unit of volume: cubic-centimeterstatic MeasureUnitCUBIC_FOOTConstant for unit of volume: cubic-footstatic MeasureUnitCUBIC_INCHConstant for unit of volume: cubic-inchstatic MeasureUnitCUBIC_KILOMETERConstant for unit of volume: cubic-kilometerstatic MeasureUnitCUBIC_METERConstant for unit of volume: cubic-meterstatic MeasureUnitCUBIC_MILEConstant for unit of volume: cubic-milestatic MeasureUnitCUBIC_YARDConstant for unit of volume: cubic-yardstatic MeasureUnitCUPConstant for unit of volume: cupstatic MeasureUnitCUP_METRICConstant for unit of volume: cup-metricstatic MeasureUnitDALTONConstant for unit of mass: daltonstatic TimeUnitDAYConstant for unit of duration: daystatic MeasureUnitDAY_PERSONConstant for unit of duration: day-personstatic MeasureUnitDECADEConstant for unit of duration: decadestatic MeasureUnitDECILITERConstant for unit of volume: deciliterstatic MeasureUnitDECIMETERConstant for unit of length: decimeterstatic MeasureUnitDEGREEConstant for unit of angle: degreestatic MeasureUnitDESSERT_SPOONConstant for unit of volume: dessert-spoonstatic MeasureUnitDESSERT_SPOON_IMPERIALConstant for unit of volume: dessert-spoon-imperialstatic MeasureUnitDOTConstant for unit of graphics: dotstatic MeasureUnitDOT_PER_CENTIMETERConstant for unit of graphics: dot-per-centimeterstatic MeasureUnitDOT_PER_INCHConstant for unit of graphics: dot-per-inchstatic MeasureUnitDRAMConstant for unit of volume: dramstatic MeasureUnitDROPConstant for unit of volume: dropstatic MeasureUnitDUNAMConstant for unit of area: dunamstatic MeasureUnitEARTH_MASSConstant for unit of mass: earth-massstatic MeasureUnitEARTH_RADIUSConstant for unit of length: earth-radiusstatic MeasureUnitELECTRONVOLTConstant for unit of energy: electronvoltstatic MeasureUnitEMConstant for unit of graphics: emstatic MeasureUnitFAHRENHEITConstant for unit of temperature: fahrenheitstatic MeasureUnitFATHOMConstant for unit of length: fathomstatic MeasureUnitFLUID_OUNCEConstant for unit of volume: fluid-ouncestatic MeasureUnitFLUID_OUNCE_IMPERIALConstant for unit of volume: fluid-ounce-imperialstatic MeasureUnitFOODCALORIEConstant for unit of energy: foodcaloriestatic MeasureUnitFOOTConstant for unit of length: footstatic MeasureUnitFURLONGConstant for unit of length: furlongstatic MeasureUnitG_FORCEConstant for unit of acceleration: g-forcestatic MeasureUnitGALLONConstant for unit of volume: gallonstatic MeasureUnitGALLON_IMPERIALConstant for unit of volume: gallon-imperialstatic MeasureUnitGENERIC_TEMPERATUREConstant for unit of temperature: genericstatic MeasureUnitGIGABITConstant for unit of digital: gigabitstatic MeasureUnitGIGABYTEConstant for unit of digital: gigabytestatic MeasureUnitGIGAHERTZConstant for unit of frequency: gigahertzstatic MeasureUnitGIGAWATTConstant for unit of power: gigawattstatic MeasureUnitGRAINConstant for unit of mass: grainstatic MeasureUnitGRAMConstant for unit of mass: gramstatic MeasureUnitHECTAREConstant for unit of area: hectarestatic MeasureUnitHECTOLITERConstant for unit of volume: hectoliterstatic MeasureUnitHECTOPASCALConstant for unit of pressure: hectopascalstatic MeasureUnitHERTZConstant for unit of frequency: hertzstatic MeasureUnitHORSEPOWERConstant for unit of power: horsepowerstatic TimeUnitHOURConstant for unit of duration: hourstatic MeasureUnitINCHConstant for unit of length: inchstatic MeasureUnitINCH_HGConstant for unit of pressure: inch-ofhgstatic MeasureUnitITEMConstant for unit of concentr: itemstatic MeasureUnitJIGGERConstant for unit of volume: jiggerstatic MeasureUnitJOULEConstant for unit of energy: joulestatic MeasureUnitKARATConstant for unit of concentr: karatstatic MeasureUnitKELVINConstant for unit of temperature: kelvinstatic MeasureUnitKILOBITConstant for unit of digital: kilobitstatic MeasureUnitKILOBYTEConstant for unit of digital: kilobytestatic MeasureUnitKILOCALORIEConstant for unit of energy: kilocaloriestatic MeasureUnitKILOGRAMConstant for unit of mass: kilogramstatic MeasureUnitKILOHERTZConstant for unit of frequency: kilohertzstatic MeasureUnitKILOJOULEConstant for unit of energy: kilojoulestatic MeasureUnitKILOMETERConstant for unit of length: kilometerstatic MeasureUnitKILOMETER_PER_HOURConstant for unit of speed: kilometer-per-hourstatic MeasureUnitKILOPASCALConstant for unit of pressure: kilopascalstatic MeasureUnitKILOWATTConstant for unit of power: kilowattstatic MeasureUnitKILOWATT_HOURConstant for unit of energy: kilowatt-hourstatic MeasureUnitKILOWATT_HOUR_PER_100_KILOMETERConstant for unit of force: kilowatt-hour-per-100-kilometerstatic MeasureUnitKNOTConstant for unit of speed: knotstatic MeasureUnitLIGHT_YEARConstant for unit of length: light-yearstatic MeasureUnitLITERConstant for unit of volume: literstatic MeasureUnitLITER_PER_100KILOMETERSConstant for unit of consumption: liter-per-100-kilometerstatic MeasureUnitLITER_PER_KILOMETERConstant for unit of consumption: liter-per-kilometerstatic MeasureUnitLUMENConstant for unit of light: lumenstatic MeasureUnitLUXConstant for unit of light: luxstatic MeasureUnitMEGABITConstant for unit of digital: megabitstatic MeasureUnitMEGABYTEConstant for unit of digital: megabytestatic MeasureUnitMEGAHERTZConstant for unit of frequency: megahertzstatic MeasureUnitMEGALITERConstant for unit of volume: megaliterstatic MeasureUnitMEGAPASCALConstant for unit of pressure: megapascalstatic MeasureUnitMEGAPIXELConstant for unit of graphics: megapixelstatic MeasureUnitMEGAWATTConstant for unit of power: megawattstatic MeasureUnitMETERConstant for unit of length: meterstatic MeasureUnitMETER_PER_SECONDConstant for unit of speed: meter-per-secondstatic MeasureUnitMETER_PER_SECOND_SQUAREDConstant for unit of acceleration: meter-per-square-secondstatic MeasureUnitMETRIC_TONConstant for unit of mass: metric-tonstatic MeasureUnitMICROGRAMConstant for unit of mass: microgramstatic MeasureUnitMICROMETERConstant for unit of length: micrometerstatic MeasureUnitMICROSECONDConstant for unit of duration: microsecondstatic MeasureUnitMILEConstant for unit of length: milestatic MeasureUnitMILE_PER_GALLONConstant for unit of consumption: mile-per-gallonstatic MeasureUnitMILE_PER_GALLON_IMPERIALConstant for unit of consumption: mile-per-gallon-imperialstatic MeasureUnitMILE_PER_HOURConstant for unit of speed: mile-per-hourstatic MeasureUnitMILE_SCANDINAVIANConstant for unit of length: mile-scandinavianstatic MeasureUnitMILLIAMPEREConstant for unit of electric: milliamperestatic MeasureUnitMILLIBARConstant for unit of pressure: millibarstatic MeasureUnitMILLIGRAMConstant for unit of mass: milligramstatic MeasureUnitMILLIGRAM_OFGLUCOSE_PER_DECILITERConstant for unit of concentr: milligram-ofglucose-per-deciliterstatic MeasureUnitMILLIGRAM_PER_DECILITERConstant for unit of concentr: milligram-per-deciliterstatic MeasureUnitMILLILITERConstant for unit of volume: milliliterstatic MeasureUnitMILLIMETERConstant for unit of length: millimeterstatic MeasureUnitMILLIMETER_OF_MERCURYConstant for unit of pressure: millimeter-ofhgstatic MeasureUnitMILLIMOLE_PER_LITERConstant for unit of concentr: millimole-per-literstatic MeasureUnitMILLISECONDConstant for unit of duration: millisecondstatic MeasureUnitMILLIWATTConstant for unit of power: milliwattstatic TimeUnitMINUTEConstant for unit of duration: minutestatic MeasureUnitMOLEConstant for unit of concentr: molestatic TimeUnitMONTHConstant for unit of duration: monthstatic MeasureUnitMONTH_PERSONConstant for unit of duration: month-personstatic MeasureUnitNANOMETERConstant for unit of length: nanometerstatic MeasureUnitNANOSECONDConstant for unit of duration: nanosecondstatic MeasureUnitNAUTICAL_MILEConstant for unit of length: nautical-milestatic MeasureUnitNEWTONConstant for unit of force: newtonstatic MeasureUnitNEWTON_METERConstant for unit of torque: newton-meterstatic MeasureUnitOHMConstant for unit of electric: ohmstatic MeasureUnitOUNCEConstant for unit of mass: ouncestatic MeasureUnitOUNCE_TROYConstant for unit of mass: ounce-troystatic MeasureUnitPARSECConstant for unit of length: parsecstatic MeasureUnitPART_PER_MILLIONConstant for unit of concentr: permillionstatic MeasureUnitPASCALConstant for unit of pressure: pascalstatic MeasureUnitPERCENTConstant for unit of concentr: percentstatic MeasureUnitPERMILLEConstant for unit of concentr: permillestatic MeasureUnitPERMYRIADConstant for unit of concentr: permyriadstatic MeasureUnitPETABYTEConstant for unit of digital: petabytestatic MeasureUnitPICOMETERConstant for unit of length: picometerstatic MeasureUnitPINCHConstant for unit of volume: pinchstatic MeasureUnitPINTConstant for unit of volume: pintstatic MeasureUnitPINT_METRICConstant for unit of volume: pint-metricstatic MeasureUnitPIXELConstant for unit of graphics: pixelstatic MeasureUnitPIXEL_PER_CENTIMETERConstant for unit of graphics: pixel-per-centimeterstatic MeasureUnitPIXEL_PER_INCHConstant for unit of graphics: pixel-per-inchstatic MeasureUnitPOINTConstant for unit of length: pointstatic MeasureUnitPOUNDConstant for unit of mass: poundstatic MeasureUnitPOUND_FOOTConstant for unit of torque: pound-force-footstatic MeasureUnitPOUND_FORCEConstant for unit of force: pound-forcestatic MeasureUnitPOUND_PER_SQUARE_INCHConstant for unit of pressure: pound-force-per-square-inchstatic MeasureUnitQUARTConstant for unit of volume: quartstatic MeasureUnitQUART_IMPERIALConstant for unit of volume: quart-imperialstatic MeasureUnitRADIANConstant for unit of angle: radianstatic MeasureUnitREVOLUTION_ANGLEConstant for unit of angle: revolutionstatic TimeUnitSECONDConstant for unit of duration: secondstatic MeasureUnitSOLAR_LUMINOSITYConstant for unit of light: solar-luminositystatic MeasureUnitSOLAR_MASSConstant for unit of mass: solar-massstatic MeasureUnitSOLAR_RADIUSConstant for unit of length: solar-radiusstatic MeasureUnitSQUARE_CENTIMETERConstant for unit of area: square-centimeterstatic MeasureUnitSQUARE_FOOTConstant for unit of area: square-footstatic MeasureUnitSQUARE_INCHConstant for unit of area: square-inchstatic MeasureUnitSQUARE_KILOMETERConstant for unit of area: square-kilometerstatic MeasureUnitSQUARE_METERConstant for unit of area: square-meterstatic MeasureUnitSQUARE_MILEConstant for unit of area: square-milestatic MeasureUnitSQUARE_YARDConstant for unit of area: square-yardstatic MeasureUnitSTONEConstant for unit of mass: stoneprotected java.lang.StringsubTypeDeprecated.This API is ICU internal only.static MeasureUnitTABLESPOONConstant for unit of volume: tablespoonstatic MeasureUnitTEASPOONConstant for unit of volume: teaspoonstatic MeasureUnitTERABITConstant for unit of digital: terabitstatic MeasureUnitTERABYTEConstant for unit of digital: terabytestatic MeasureUnitTHERM_USConstant for unit of energy: therm-usstatic MeasureUnitTONConstant for unit of mass: tonprotected java.lang.StringtypeDeprecated.This API is ICU internal only.static MeasureUnitVOLTConstant for unit of electric: voltstatic MeasureUnitWATTConstant for unit of power: wattstatic TimeUnitWEEKConstant for unit of duration: weekstatic MeasureUnitWEEK_PERSONConstant for unit of duration: week-personstatic MeasureUnitYARDConstant for unit of length: yardstatic TimeUnitYEARConstant for unit of duration: yearstatic MeasureUnitYEAR_PERSONConstant for unit of duration: year-person
-
Constructor Summary
Constructors Modifier Constructor Description protectedMeasureUnit(java.lang.String type, java.lang.String subType)Deprecated.This API is ICU internal only.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected static MeasureUnitaddUnit(java.lang.String type, java.lang.String unitName, MeasureUnit.Factory factory)Deprecated.This API is ICU internal only.booleanequals(java.lang.Object rhs)static MeasureUnitfindBySubType(java.lang.String subType)Deprecated.This API is ICU internal only.static MeasureUnitforIdentifier(java.lang.String identifier)Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS 35.static MeasureUnitfromMeasureUnitImpl(com.ibm.icu.impl.units.MeasureUnitImpl measureUnitImpl)Deprecated.Internal API for ICU use only.static java.util.Set<MeasureUnit>getAvailable()Get all of the available units.static java.util.Set<MeasureUnit>getAvailable(java.lang.String type)For the given type, return the available units.static java.util.Set<java.lang.String>getAvailableTypes()Get all of the available units' types.MeasureUnit.ComplexitygetComplexity()Compute the complexity of the unit.com.ibm.icu.impl.units.MeasureUnitImplgetCopyOfMeasureUnitImpl()Deprecated.This API is ICU internal only.intgetDimensionality()Returns the dimensionality (power) of this MeasureUnit.java.lang.StringgetIdentifier()Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.MeasureUnit.MeasurePrefixgetPrefix()Returns the current SI or binary prefix of this SINGLE unit.java.lang.StringgetSubtype()Get the subType, such as “foot”.java.lang.StringgetType()Get the type, such as "length".inthashCode()static MeasureUnitinternalGetInstance(java.lang.String type, java.lang.String subType)Deprecated.This API is ICU internal only.MeasureUnitproduct(MeasureUnit other)Computes the product of this unit with another unit.MeasureUnitreciprocal()Computes the reciprocal of this MeasureUnit, with the numerator and denominator flipped.java.util.List<MeasureUnit>splitToSingleUnits()Returns the list of SINGLE units contained within a sequence of COMPOUND units.java.lang.StringtoString()MeasureUnitwithDimensionality(int dimensionality)Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality (power).MeasureUnitwithPrefix(MeasureUnit.MeasurePrefix prefix)Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix.
-
-
-
Field Detail
-
type
@Deprecated protected final java.lang.String type
Deprecated.This API is ICU internal only.If type set to null, measureUnitImpl is in use instead of type and subType.
-
subType
@Deprecated protected final java.lang.String subType
Deprecated.This API is ICU internal only.If subType set to null, measureUnitImpl is in use instead of type and subType.
-
G_FORCE
public static final MeasureUnit G_FORCE
Constant for unit of acceleration: g-force
-
METER_PER_SECOND_SQUARED
public static final MeasureUnit METER_PER_SECOND_SQUARED
Constant for unit of acceleration: meter-per-square-second
-
ARC_MINUTE
public static final MeasureUnit ARC_MINUTE
Constant for unit of angle: arc-minute
-
ARC_SECOND
public static final MeasureUnit ARC_SECOND
Constant for unit of angle: arc-second
-
DEGREE
public static final MeasureUnit DEGREE
Constant for unit of angle: degree
-
RADIAN
public static final MeasureUnit RADIAN
Constant for unit of angle: radian
-
REVOLUTION_ANGLE
public static final MeasureUnit REVOLUTION_ANGLE
Constant for unit of angle: revolution
-
ACRE
public static final MeasureUnit ACRE
Constant for unit of area: acre
-
DUNAM
public static final MeasureUnit DUNAM
Constant for unit of area: dunam
-
HECTARE
public static final MeasureUnit HECTARE
Constant for unit of area: hectare
-
SQUARE_CENTIMETER
public static final MeasureUnit SQUARE_CENTIMETER
Constant for unit of area: square-centimeter
-
SQUARE_FOOT
public static final MeasureUnit SQUARE_FOOT
Constant for unit of area: square-foot
-
SQUARE_INCH
public static final MeasureUnit SQUARE_INCH
Constant for unit of area: square-inch
-
SQUARE_KILOMETER
public static final MeasureUnit SQUARE_KILOMETER
Constant for unit of area: square-kilometer
-
SQUARE_METER
public static final MeasureUnit SQUARE_METER
Constant for unit of area: square-meter
-
SQUARE_MILE
public static final MeasureUnit SQUARE_MILE
Constant for unit of area: square-mile
-
SQUARE_YARD
public static final MeasureUnit SQUARE_YARD
Constant for unit of area: square-yard
-
ITEM
public static final MeasureUnit ITEM
Constant for unit of concentr: item
-
KARAT
public static final MeasureUnit KARAT
Constant for unit of concentr: karat
-
MILLIGRAM_OFGLUCOSE_PER_DECILITER
public static final MeasureUnit MILLIGRAM_OFGLUCOSE_PER_DECILITER
Constant for unit of concentr: milligram-ofglucose-per-deciliter
-
MILLIGRAM_PER_DECILITER
public static final MeasureUnit MILLIGRAM_PER_DECILITER
Constant for unit of concentr: milligram-per-deciliter
-
MILLIMOLE_PER_LITER
public static final MeasureUnit MILLIMOLE_PER_LITER
Constant for unit of concentr: millimole-per-liter
-
MOLE
public static final MeasureUnit MOLE
Constant for unit of concentr: mole
-
PERCENT
public static final MeasureUnit PERCENT
Constant for unit of concentr: percent
-
PERMILLE
public static final MeasureUnit PERMILLE
Constant for unit of concentr: permille
-
PART_PER_MILLION
public static final MeasureUnit PART_PER_MILLION
Constant for unit of concentr: permillion
-
PERMYRIAD
public static final MeasureUnit PERMYRIAD
Constant for unit of concentr: permyriad
-
LITER_PER_100KILOMETERS
public static final MeasureUnit LITER_PER_100KILOMETERS
Constant for unit of consumption: liter-per-100-kilometer
-
LITER_PER_KILOMETER
public static final MeasureUnit LITER_PER_KILOMETER
Constant for unit of consumption: liter-per-kilometer
-
MILE_PER_GALLON
public static final MeasureUnit MILE_PER_GALLON
Constant for unit of consumption: mile-per-gallon
-
MILE_PER_GALLON_IMPERIAL
public static final MeasureUnit MILE_PER_GALLON_IMPERIAL
Constant for unit of consumption: mile-per-gallon-imperial
-
BIT
public static final MeasureUnit BIT
Constant for unit of digital: bit
-
BYTE
public static final MeasureUnit BYTE
Constant for unit of digital: byte
-
GIGABIT
public static final MeasureUnit GIGABIT
Constant for unit of digital: gigabit
-
GIGABYTE
public static final MeasureUnit GIGABYTE
Constant for unit of digital: gigabyte
-
KILOBIT
public static final MeasureUnit KILOBIT
Constant for unit of digital: kilobit
-
KILOBYTE
public static final MeasureUnit KILOBYTE
Constant for unit of digital: kilobyte
-
MEGABIT
public static final MeasureUnit MEGABIT
Constant for unit of digital: megabit
-
MEGABYTE
public static final MeasureUnit MEGABYTE
Constant for unit of digital: megabyte
-
PETABYTE
public static final MeasureUnit PETABYTE
Constant for unit of digital: petabyte
-
TERABIT
public static final MeasureUnit TERABIT
Constant for unit of digital: terabit
-
TERABYTE
public static final MeasureUnit TERABYTE
Constant for unit of digital: terabyte
-
CENTURY
public static final MeasureUnit CENTURY
Constant for unit of duration: century
-
DAY
public static final TimeUnit DAY
Constant for unit of duration: day
-
DAY_PERSON
public static final MeasureUnit DAY_PERSON
Constant for unit of duration: day-person
-
DECADE
public static final MeasureUnit DECADE
Constant for unit of duration: decade
-
HOUR
public static final TimeUnit HOUR
Constant for unit of duration: hour
-
MICROSECOND
public static final MeasureUnit MICROSECOND
Constant for unit of duration: microsecond
-
MILLISECOND
public static final MeasureUnit MILLISECOND
Constant for unit of duration: millisecond
-
MINUTE
public static final TimeUnit MINUTE
Constant for unit of duration: minute
-
MONTH
public static final TimeUnit MONTH
Constant for unit of duration: month
-
MONTH_PERSON
public static final MeasureUnit MONTH_PERSON
Constant for unit of duration: month-person
-
NANOSECOND
public static final MeasureUnit NANOSECOND
Constant for unit of duration: nanosecond
-
SECOND
public static final TimeUnit SECOND
Constant for unit of duration: second
-
WEEK
public static final TimeUnit WEEK
Constant for unit of duration: week
-
WEEK_PERSON
public static final MeasureUnit WEEK_PERSON
Constant for unit of duration: week-person
-
YEAR
public static final TimeUnit YEAR
Constant for unit of duration: year
-
YEAR_PERSON
public static final MeasureUnit YEAR_PERSON
Constant for unit of duration: year-person
-
AMPERE
public static final MeasureUnit AMPERE
Constant for unit of electric: ampere
-
MILLIAMPERE
public static final MeasureUnit MILLIAMPERE
Constant for unit of electric: milliampere
-
OHM
public static final MeasureUnit OHM
Constant for unit of electric: ohm
-
VOLT
public static final MeasureUnit VOLT
Constant for unit of electric: volt
-
BRITISH_THERMAL_UNIT
public static final MeasureUnit BRITISH_THERMAL_UNIT
Constant for unit of energy: british-thermal-unit
-
CALORIE
public static final MeasureUnit CALORIE
Constant for unit of energy: calorie
-
ELECTRONVOLT
public static final MeasureUnit ELECTRONVOLT
Constant for unit of energy: electronvolt
-
FOODCALORIE
public static final MeasureUnit FOODCALORIE
Constant for unit of energy: foodcalorie
-
JOULE
public static final MeasureUnit JOULE
Constant for unit of energy: joule
-
KILOCALORIE
public static final MeasureUnit KILOCALORIE
Constant for unit of energy: kilocalorie
-
KILOJOULE
public static final MeasureUnit KILOJOULE
Constant for unit of energy: kilojoule
-
KILOWATT_HOUR
public static final MeasureUnit KILOWATT_HOUR
Constant for unit of energy: kilowatt-hour
-
THERM_US
public static final MeasureUnit THERM_US
Constant for unit of energy: therm-us
-
KILOWATT_HOUR_PER_100_KILOMETER
public static final MeasureUnit KILOWATT_HOUR_PER_100_KILOMETER
Constant for unit of force: kilowatt-hour-per-100-kilometer
-
NEWTON
public static final MeasureUnit NEWTON
Constant for unit of force: newton
-
POUND_FORCE
public static final MeasureUnit POUND_FORCE
Constant for unit of force: pound-force
-
GIGAHERTZ
public static final MeasureUnit GIGAHERTZ
Constant for unit of frequency: gigahertz
-
HERTZ
public static final MeasureUnit HERTZ
Constant for unit of frequency: hertz
-
KILOHERTZ
public static final MeasureUnit KILOHERTZ
Constant for unit of frequency: kilohertz
-
MEGAHERTZ
public static final MeasureUnit MEGAHERTZ
Constant for unit of frequency: megahertz
-
DOT
public static final MeasureUnit DOT
Constant for unit of graphics: dot
-
DOT_PER_CENTIMETER
public static final MeasureUnit DOT_PER_CENTIMETER
Constant for unit of graphics: dot-per-centimeter
-
DOT_PER_INCH
public static final MeasureUnit DOT_PER_INCH
Constant for unit of graphics: dot-per-inch
-
EM
public static final MeasureUnit EM
Constant for unit of graphics: em
-
MEGAPIXEL
public static final MeasureUnit MEGAPIXEL
Constant for unit of graphics: megapixel
-
PIXEL
public static final MeasureUnit PIXEL
Constant for unit of graphics: pixel
-
PIXEL_PER_CENTIMETER
public static final MeasureUnit PIXEL_PER_CENTIMETER
Constant for unit of graphics: pixel-per-centimeter
-
PIXEL_PER_INCH
public static final MeasureUnit PIXEL_PER_INCH
Constant for unit of graphics: pixel-per-inch
-
ASTRONOMICAL_UNIT
public static final MeasureUnit ASTRONOMICAL_UNIT
Constant for unit of length: astronomical-unit
-
CENTIMETER
public static final MeasureUnit CENTIMETER
Constant for unit of length: centimeter
-
DECIMETER
public static final MeasureUnit DECIMETER
Constant for unit of length: decimeter
-
EARTH_RADIUS
public static final MeasureUnit EARTH_RADIUS
Constant for unit of length: earth-radius
-
FATHOM
public static final MeasureUnit FATHOM
Constant for unit of length: fathom
-
FOOT
public static final MeasureUnit FOOT
Constant for unit of length: foot
-
FURLONG
public static final MeasureUnit FURLONG
Constant for unit of length: furlong
-
INCH
public static final MeasureUnit INCH
Constant for unit of length: inch
-
KILOMETER
public static final MeasureUnit KILOMETER
Constant for unit of length: kilometer
-
LIGHT_YEAR
public static final MeasureUnit LIGHT_YEAR
Constant for unit of length: light-year
-
METER
public static final MeasureUnit METER
Constant for unit of length: meter
-
MICROMETER
public static final MeasureUnit MICROMETER
Constant for unit of length: micrometer
-
MILE
public static final MeasureUnit MILE
Constant for unit of length: mile
-
MILE_SCANDINAVIAN
public static final MeasureUnit MILE_SCANDINAVIAN
Constant for unit of length: mile-scandinavian
-
MILLIMETER
public static final MeasureUnit MILLIMETER
Constant for unit of length: millimeter
-
NANOMETER
public static final MeasureUnit NANOMETER
Constant for unit of length: nanometer
-
NAUTICAL_MILE
public static final MeasureUnit NAUTICAL_MILE
Constant for unit of length: nautical-mile
-
PARSEC
public static final MeasureUnit PARSEC
Constant for unit of length: parsec
-
PICOMETER
public static final MeasureUnit PICOMETER
Constant for unit of length: picometer
-
POINT
public static final MeasureUnit POINT
Constant for unit of length: point
-
SOLAR_RADIUS
public static final MeasureUnit SOLAR_RADIUS
Constant for unit of length: solar-radius
-
YARD
public static final MeasureUnit YARD
Constant for unit of length: yard
-
CANDELA
public static final MeasureUnit CANDELA
Constant for unit of light: candela
-
LUMEN
public static final MeasureUnit LUMEN
Constant for unit of light: lumen
-
LUX
public static final MeasureUnit LUX
Constant for unit of light: lux
-
SOLAR_LUMINOSITY
public static final MeasureUnit SOLAR_LUMINOSITY
Constant for unit of light: solar-luminosity
-
CARAT
public static final MeasureUnit CARAT
Constant for unit of mass: carat
-
DALTON
public static final MeasureUnit DALTON
Constant for unit of mass: dalton
-
EARTH_MASS
public static final MeasureUnit EARTH_MASS
Constant for unit of mass: earth-mass
-
GRAIN
public static final MeasureUnit GRAIN
Constant for unit of mass: grain
-
GRAM
public static final MeasureUnit GRAM
Constant for unit of mass: gram
-
KILOGRAM
public static final MeasureUnit KILOGRAM
Constant for unit of mass: kilogram
-
METRIC_TON
public static final MeasureUnit METRIC_TON
Constant for unit of mass: metric-ton
-
MICROGRAM
public static final MeasureUnit MICROGRAM
Constant for unit of mass: microgram
-
MILLIGRAM
public static final MeasureUnit MILLIGRAM
Constant for unit of mass: milligram
-
OUNCE
public static final MeasureUnit OUNCE
Constant for unit of mass: ounce
-
OUNCE_TROY
public static final MeasureUnit OUNCE_TROY
Constant for unit of mass: ounce-troy
-
POUND
public static final MeasureUnit POUND
Constant for unit of mass: pound
-
SOLAR_MASS
public static final MeasureUnit SOLAR_MASS
Constant for unit of mass: solar-mass
-
STONE
public static final MeasureUnit STONE
Constant for unit of mass: stone
-
TON
public static final MeasureUnit TON
Constant for unit of mass: ton
-
GIGAWATT
public static final MeasureUnit GIGAWATT
Constant for unit of power: gigawatt
-
HORSEPOWER
public static final MeasureUnit HORSEPOWER
Constant for unit of power: horsepower
-
KILOWATT
public static final MeasureUnit KILOWATT
Constant for unit of power: kilowatt
-
MEGAWATT
public static final MeasureUnit MEGAWATT
Constant for unit of power: megawatt
-
MILLIWATT
public static final MeasureUnit MILLIWATT
Constant for unit of power: milliwatt
-
WATT
public static final MeasureUnit WATT
Constant for unit of power: watt
-
ATMOSPHERE
public static final MeasureUnit ATMOSPHERE
Constant for unit of pressure: atmosphere
-
BAR
public static final MeasureUnit BAR
Constant for unit of pressure: bar
-
HECTOPASCAL
public static final MeasureUnit HECTOPASCAL
Constant for unit of pressure: hectopascal
-
INCH_HG
public static final MeasureUnit INCH_HG
Constant for unit of pressure: inch-ofhg
-
KILOPASCAL
public static final MeasureUnit KILOPASCAL
Constant for unit of pressure: kilopascal
-
MEGAPASCAL
public static final MeasureUnit MEGAPASCAL
Constant for unit of pressure: megapascal
-
MILLIBAR
public static final MeasureUnit MILLIBAR
Constant for unit of pressure: millibar
-
MILLIMETER_OF_MERCURY
public static final MeasureUnit MILLIMETER_OF_MERCURY
Constant for unit of pressure: millimeter-ofhg
-
PASCAL
public static final MeasureUnit PASCAL
Constant for unit of pressure: pascal
-
POUND_PER_SQUARE_INCH
public static final MeasureUnit POUND_PER_SQUARE_INCH
Constant for unit of pressure: pound-force-per-square-inch
-
KILOMETER_PER_HOUR
public static final MeasureUnit KILOMETER_PER_HOUR
Constant for unit of speed: kilometer-per-hour
-
KNOT
public static final MeasureUnit KNOT
Constant for unit of speed: knot
-
METER_PER_SECOND
public static final MeasureUnit METER_PER_SECOND
Constant for unit of speed: meter-per-second
-
MILE_PER_HOUR
public static final MeasureUnit MILE_PER_HOUR
Constant for unit of speed: mile-per-hour
-
CELSIUS
public static final MeasureUnit CELSIUS
Constant for unit of temperature: celsius
-
FAHRENHEIT
public static final MeasureUnit FAHRENHEIT
Constant for unit of temperature: fahrenheit
-
GENERIC_TEMPERATURE
public static final MeasureUnit GENERIC_TEMPERATURE
Constant for unit of temperature: generic
-
KELVIN
public static final MeasureUnit KELVIN
Constant for unit of temperature: kelvin
-
NEWTON_METER
public static final MeasureUnit NEWTON_METER
Constant for unit of torque: newton-meter
-
POUND_FOOT
public static final MeasureUnit POUND_FOOT
Constant for unit of torque: pound-force-foot
-
ACRE_FOOT
public static final MeasureUnit ACRE_FOOT
Constant for unit of volume: acre-foot
-
BARREL
public static final MeasureUnit BARREL
Constant for unit of volume: barrel
-
BUSHEL
public static final MeasureUnit BUSHEL
Constant for unit of volume: bushel
-
CENTILITER
public static final MeasureUnit CENTILITER
Constant for unit of volume: centiliter
-
CUBIC_CENTIMETER
public static final MeasureUnit CUBIC_CENTIMETER
Constant for unit of volume: cubic-centimeter
-
CUBIC_FOOT
public static final MeasureUnit CUBIC_FOOT
Constant for unit of volume: cubic-foot
-
CUBIC_INCH
public static final MeasureUnit CUBIC_INCH
Constant for unit of volume: cubic-inch
-
CUBIC_KILOMETER
public static final MeasureUnit CUBIC_KILOMETER
Constant for unit of volume: cubic-kilometer
-
CUBIC_METER
public static final MeasureUnit CUBIC_METER
Constant for unit of volume: cubic-meter
-
CUBIC_MILE
public static final MeasureUnit CUBIC_MILE
Constant for unit of volume: cubic-mile
-
CUBIC_YARD
public static final MeasureUnit CUBIC_YARD
Constant for unit of volume: cubic-yard
-
CUP
public static final MeasureUnit CUP
Constant for unit of volume: cup
-
CUP_METRIC
public static final MeasureUnit CUP_METRIC
Constant for unit of volume: cup-metric
-
DECILITER
public static final MeasureUnit DECILITER
Constant for unit of volume: deciliter
-
DESSERT_SPOON
public static final MeasureUnit DESSERT_SPOON
Constant for unit of volume: dessert-spoon
-
DESSERT_SPOON_IMPERIAL
public static final MeasureUnit DESSERT_SPOON_IMPERIAL
Constant for unit of volume: dessert-spoon-imperial
-
DRAM
public static final MeasureUnit DRAM
Constant for unit of volume: dram
-
DROP
public static final MeasureUnit DROP
Constant for unit of volume: drop
-
FLUID_OUNCE
public static final MeasureUnit FLUID_OUNCE
Constant for unit of volume: fluid-ounce
-
FLUID_OUNCE_IMPERIAL
public static final MeasureUnit FLUID_OUNCE_IMPERIAL
Constant for unit of volume: fluid-ounce-imperial
-
GALLON
public static final MeasureUnit GALLON
Constant for unit of volume: gallon
-
GALLON_IMPERIAL
public static final MeasureUnit GALLON_IMPERIAL
Constant for unit of volume: gallon-imperial
-
HECTOLITER
public static final MeasureUnit HECTOLITER
Constant for unit of volume: hectoliter
-
JIGGER
public static final MeasureUnit JIGGER
Constant for unit of volume: jigger
-
LITER
public static final MeasureUnit LITER
Constant for unit of volume: liter
-
MEGALITER
public static final MeasureUnit MEGALITER
Constant for unit of volume: megaliter
-
MILLILITER
public static final MeasureUnit MILLILITER
Constant for unit of volume: milliliter
-
PINCH
public static final MeasureUnit PINCH
Constant for unit of volume: pinch
-
PINT
public static final MeasureUnit PINT
Constant for unit of volume: pint
-
PINT_METRIC
public static final MeasureUnit PINT_METRIC
Constant for unit of volume: pint-metric
-
QUART
public static final MeasureUnit QUART
Constant for unit of volume: quart
-
QUART_IMPERIAL
public static final MeasureUnit QUART_IMPERIAL
Constant for unit of volume: quart-imperial
-
TABLESPOON
public static final MeasureUnit TABLESPOON
Constant for unit of volume: tablespoon
-
TEASPOON
public static final MeasureUnit TEASPOON
Constant for unit of volume: teaspoon
-
-
Method Detail
-
forIdentifier
public static MeasureUnit forIdentifier(java.lang.String identifier)
Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS 35. (Core unit identifiers and mixed unit identifiers are supported, long unit identifiers are not.) Validates and canonicalizes the identifier. Note: dimensionlessMeasureUnitisnullMeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")- Parameters:
identifier- CLDR Unit Identifier- Throws:
java.lang.IllegalArgumentException- if the identifier is invalid.
-
fromMeasureUnitImpl
@Deprecated public static MeasureUnit fromMeasureUnitImpl(com.ibm.icu.impl.units.MeasureUnitImpl measureUnitImpl)
Deprecated.Internal API for ICU use only.
-
getType
public java.lang.String getType()
Get the type, such as "length". May return null.
-
getSubtype
public java.lang.String getSubtype()
Get the subType, such as “foot”. May return null.
-
getIdentifier
public java.lang.String getIdentifier()
Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.- Returns:
- The string form of this unit.
-
getComplexity
public MeasureUnit.Complexity getComplexity()
Compute the complexity of the unit. See Complexity for more information.- Returns:
- The unit complexity.
-
withPrefix
public MeasureUnit withPrefix(MeasureUnit.MeasurePrefix prefix)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix. For example, MeasurePrefix.KILO for "kilo", or MeasurePrefix.KIBI for "kibi". May return `this` if this unit already has that prefix.There is sufficient locale data to format all standard prefixes.
NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will occur. For more information, see `Complexity`.
- Parameters:
prefix- The prefix, from MeasurePrefix.- Returns:
- A new SINGLE unit.
- Throws:
java.lang.UnsupportedOperationException- if this unit is a COMPOUND or MIXED unit.
-
getPrefix
public MeasureUnit.MeasurePrefix getPrefix()
Returns the current SI or binary prefix of this SINGLE unit. For example, if the unit has the prefix "kilo", then MeasurePrefix.KILO is returned.NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an error will occur. For more information, see `Complexity`.
- Returns:
- The prefix of this SINGLE unit, from MeasurePrefix.
- Throws:
java.lang.UnsupportedOperationException- if the unit is COMPOUND or MIXED.
-
getDimensionality
public int getDimensionality()
Returns the dimensionality (power) of this MeasureUnit. For example, if the unit is square, then 2 is returned.NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an exception will be thrown. For more information, see `Complexity`.
- Returns:
- The dimensionality (power) of this simple unit.
- Throws:
java.lang.UnsupportedOperationException- if the unit is COMPOUND or MIXED.
-
withDimensionality
public MeasureUnit withDimensionality(int dimensionality)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality (power). For example, if dimensionality is 2, the unit will be squared.NOTE: Only works on SINGLE units. If this is a COMPOUND or MIXED unit, an exception is thrown. For more information, see `Complexity`.
- Parameters:
dimensionality- The dimensionality (power).- Returns:
- A new SINGLE unit.
- Throws:
java.lang.UnsupportedOperationException- if the unit is COMPOUND or MIXED.
-
reciprocal
public MeasureUnit reciprocal()
Computes the reciprocal of this MeasureUnit, with the numerator and denominator flipped.For example, if the receiver is "meter-per-second", the unit "second-per-meter" is returned.
NOTE: Only works on SINGLE and COMPOUND units. If this is a MIXED unit, an error will occur. For more information, see `Complexity`.
- Returns:
- The reciprocal of the target unit.
- Throws:
java.lang.UnsupportedOperationException- if the unit is MIXED.
-
product
public MeasureUnit product(MeasureUnit other)
Computes the product of this unit with another unit. This is a way to build units from constituent parts.The numerator and denominator are preserved through this operation.
For example, if the receiver is "kilowatt" and the argument is "hour-per-day", then the unit "kilowatt-hour-per-day" is returned.
NOTE: Only works on SINGLE and COMPOUND units. If either unit (receivee and argument) is a MIXED unit, an error will occur. For more information, see `Complexity`.
- Parameters:
other- The MeasureUnit to multiply with the target.- Returns:
- The product of the target unit with the provided unit.
- Throws:
java.lang.UnsupportedOperationException- if the unit is MIXED.
-
splitToSingleUnits
public java.util.List<MeasureUnit> splitToSingleUnits()
Returns the list of SINGLE units contained within a sequence of COMPOUND units.Examples: - Given "meter-kilogram-per-second", three units will be returned: "meter", "kilogram", and "per-second". - Given "hour+minute+second", three units will be returned: "hour", "minute", and "second".
If this is a SINGLE unit, a list of length 1 will be returned.
- Returns:
- An unmodifiable list of single units
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object rhs)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getAvailableTypes
public static java.util.Set<java.lang.String> getAvailableTypes()
Get all of the available units' types. Returned set is unmodifiable.
-
getAvailable
public static java.util.Set<MeasureUnit> getAvailable(java.lang.String type)
For the given type, return the available units.- Parameters:
type- the type- Returns:
- the available units for type. Returned set is unmodifiable.
-
getAvailable
public static java.util.Set<MeasureUnit> getAvailable()
Get all of the available units. Returned set is unmodifiable.
-
internalGetInstance
@Deprecated public static MeasureUnit internalGetInstance(java.lang.String type, java.lang.String subType)
Deprecated.This API is ICU internal only.Creates a MeasureUnit instance (creates a singleton instance) or returns one from the cache.Normally this method should not be used, since there will be no formatting data available for it, and it may not be returned by getAvailable(). However, for special purposes (such as CLDR tooling), it is available.
-
findBySubType
@Deprecated public static MeasureUnit findBySubType(java.lang.String subType)
Deprecated.This API is ICU internal only.
-
addUnit
@Deprecated protected static MeasureUnit addUnit(java.lang.String type, java.lang.String unitName, MeasureUnit.Factory factory)
Deprecated.This API is ICU internal only.
-
getCopyOfMeasureUnitImpl
@Deprecated public com.ibm.icu.impl.units.MeasureUnitImpl getCopyOfMeasureUnitImpl()
Deprecated.This API is ICU internal only.- Returns:
- this object in a MeasureUnitImpl form.
-
-