MeasureUnit
public
class
MeasureUnit
extends Object
implements
Serializable
java.lang.Object | |
↳ | android.icu.util.MeasureUnit |
A 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.)
See also:
Summary
Fields | |
---|---|
public
static
final
MeasureUnit |
ACRE
Constant for unit of area: acre |
public
static
final
MeasureUnit |
ACRE_FOOT
Constant for unit of volume: acre-foot |
public
static
final
MeasureUnit |
AMPERE
Constant for unit of electric: ampere |
public
static
final
MeasureUnit |
ARC_MINUTE
Constant for unit of angle: arc-minute |
public
static
final
MeasureUnit |
ARC_SECOND
Constant for unit of angle: arc-second |
public
static
final
MeasureUnit |
ASTRONOMICAL_UNIT
Constant for unit of length: astronomical-unit |
public
static
final
MeasureUnit |
ATMOSPHERE
Constant for unit of pressure: atmosphere |
public
static
final
MeasureUnit |
BIT
Constant for unit of digital: bit |
public
static
final
MeasureUnit |
BUSHEL
Constant for unit of volume: bushel |
public
static
final
MeasureUnit |
BYTE
Constant for unit of digital: byte |
public
static
final
MeasureUnit |
CALORIE
Constant for unit of energy: calorie |
public
static
final
MeasureUnit |
CANDELA
Constant for unit of light: candela |
public
static
final
MeasureUnit |
CARAT
Constant for unit of mass: carat |
public
static
final
MeasureUnit |
CELSIUS
Constant for unit of temperature: celsius |
public
static
final
MeasureUnit |
CENTILITER
Constant for unit of volume: centiliter |
public
static
final
MeasureUnit |
CENTIMETER
Constant for unit of length: centimeter |
public
static
final
MeasureUnit |
CENTURY
Constant for unit of duration: century |
public
static
final
MeasureUnit |
CUBIC_CENTIMETER
Constant for unit of volume: cubic-centimeter |
public
static
final
MeasureUnit |
CUBIC_FOOT
Constant for unit of volume: cubic-foot |
public
static
final
MeasureUnit |
CUBIC_INCH
Constant for unit of volume: cubic-inch |
public
static
final
MeasureUnit |
CUBIC_KILOMETER
Constant for unit of volume: cubic-kilometer |
public
static
final
MeasureUnit |
CUBIC_METER
Constant for unit of volume: cubic-meter |
public
static
final
MeasureUnit |
CUBIC_MILE
Constant for unit of volume: cubic-mile |
public
static
final
MeasureUnit |
CUBIC_YARD
Constant for unit of volume: cubic-yard |
public
static
final
MeasureUnit |
CUP
Constant for unit of volume: cup |
public
static
final
MeasureUnit |
CUP_METRIC
Constant for unit of volume: cup-metric |
public
static
final
TimeUnit |
DAY
Constant for unit of duration: day |
public
static
final
MeasureUnit |
DECADE
Constant for unit of duration: decade |
public
static
final
MeasureUnit |
DECILITER
Constant for unit of volume: deciliter |
public
static
final
MeasureUnit |
DECIMETER
Constant for unit of length: decimeter |
public
static
final
MeasureUnit |
DEGREE
Constant for unit of angle: degree |
public
static
final
MeasureUnit |
DOT
Constant for unit of graphics: dot |
public
static
final
MeasureUnit |
DOT_PER_CENTIMETER
Constant for unit of graphics: dot-per-centimeter |
public
static
final
MeasureUnit |
DOT_PER_INCH
Constant for unit of graphics: dot-per-inch |
public
static
final
MeasureUnit |
EM
Constant for unit of graphics: em |
public
static
final
MeasureUnit |
FAHRENHEIT
Constant for unit of temperature: fahrenheit |
public
static
final
MeasureUnit |
FATHOM
Constant for unit of length: fathom |
public
static
final
MeasureUnit |
FLUID_OUNCE
Constant for unit of volume: fluid-ounce |
public
static
final
MeasureUnit |
FOODCALORIE
Constant for unit of energy: foodcalorie |
public
static
final
MeasureUnit |
FOOT
Constant for unit of length: foot |
public
static
final
MeasureUnit |
FURLONG
Constant for unit of length: furlong |
public
static
final
MeasureUnit |
GALLON
Constant for unit of volume: gallon |
public
static
final
MeasureUnit |
GALLON_IMPERIAL
Constant for unit of volume: gallon-imperial |
public
static
final
MeasureUnit |
GENERIC_TEMPERATURE
Constant for unit of temperature: generic |
public
static
final
MeasureUnit |
GIGABIT
Constant for unit of digital: gigabit |
public
static
final
MeasureUnit |
GIGABYTE
Constant for unit of digital: gigabyte |
public
static
final
MeasureUnit |
GIGAHERTZ
Constant for unit of frequency: gigahertz |
public
static
final
MeasureUnit |
GIGAWATT
Constant for unit of power: gigawatt |
public
static
final
MeasureUnit |
GRAM
Constant for unit of mass: gram |
public
static
final
MeasureUnit |
G_FORCE
Constant for unit of acceleration: g-force |
public
static
final
MeasureUnit |
HECTARE
Constant for unit of area: hectare |
public
static
final
MeasureUnit |
HECTOLITER
Constant for unit of volume: hectoliter |
public
static
final
MeasureUnit |
HECTOPASCAL
Constant for unit of pressure: hectopascal |
public
static
final
MeasureUnit |
HERTZ
Constant for unit of frequency: hertz |
public
static
final
MeasureUnit |
HORSEPOWER
Constant for unit of power: horsepower |
public
static
final
TimeUnit |
HOUR
Constant for unit of duration: hour |
public
static
final
MeasureUnit |
INCH
Constant for unit of length: inch |
public
static
final
MeasureUnit |
INCH_HG
Constant for unit of pressure: inch-ofhg |
public
static
final
MeasureUnit |
ITEM
Constant for unit of concentr: item |
public
static
final
MeasureUnit |
JOULE
Constant for unit of energy: joule |
public
static
final
MeasureUnit |
KARAT
Constant for unit of concentr: karat |
public
static
final
MeasureUnit |
KELVIN
Constant for unit of temperature: kelvin |
public
static
final
MeasureUnit |
KILOBIT
Constant for unit of digital: kilobit |
public
static
final
MeasureUnit |
KILOBYTE
Constant for unit of digital: kilobyte |
public
static
final
MeasureUnit |
KILOCALORIE
Constant for unit of energy: kilocalorie |
public
static
final
MeasureUnit |
KILOGRAM
Constant for unit of mass: kilogram |
public
static
final
MeasureUnit |
KILOHERTZ
Constant for unit of frequency: kilohertz |
public
static
final
MeasureUnit |
KILOJOULE
Constant for unit of energy: kilojoule |
public
static
final
MeasureUnit |
KILOMETER
Constant for unit of length: kilometer |
public
static
final
MeasureUnit |
KILOMETER_PER_HOUR
Constant for unit of speed: kilometer-per-hour |
public
static
final
MeasureUnit |
KILOWATT
Constant for unit of power: kilowatt |
public
static
final
MeasureUnit |
KILOWATT_HOUR
Constant for unit of energy: kilowatt-hour |
public
static
final
MeasureUnit |
KILOWATT_HOUR_PER_100_KILOMETER
Constant for unit of force: kilowatt-hour-per-100-kilometer |
public
static
final
MeasureUnit |
KNOT
Constant for unit of speed: knot |
public
static
final
MeasureUnit |
LIGHT_YEAR
Constant for unit of length: light-year |
public
static
final
MeasureUnit |
LITER
Constant for unit of volume: liter |
public
static
final
MeasureUnit |
LITER_PER_100KILOMETERS
Constant for unit of consumption: liter-per-100-kilometer |
public
static
final
MeasureUnit |
LITER_PER_KILOMETER
Constant for unit of consumption: liter-per-kilometer |
public
static
final
MeasureUnit |
LUMEN
Constant for unit of light: lumen |
public
static
final
MeasureUnit |
LUX
Constant for unit of light: lux |
public
static
final
MeasureUnit |
MEGABIT
Constant for unit of digital: megabit |
public
static
final
MeasureUnit |
MEGABYTE
Constant for unit of digital: megabyte |
public
static
final
MeasureUnit |
MEGAHERTZ
Constant for unit of frequency: megahertz |
public
static
final
MeasureUnit |
MEGALITER
Constant for unit of volume: megaliter |
public
static
final
MeasureUnit |
MEGAPIXEL
Constant for unit of graphics: megapixel |
public
static
final
MeasureUnit |
MEGAWATT
Constant for unit of power: megawatt |
public
static
final
MeasureUnit |
METER
Constant for unit of length: meter |
public
static
final
MeasureUnit |
METER_PER_SECOND
Constant for unit of speed: meter-per-second |
public
static
final
MeasureUnit |
METER_PER_SECOND_SQUARED
Constant for unit of acceleration: meter-per-square-second |
public
static
final
MeasureUnit |
METRIC_TON
Constant for unit of mass: metric-ton (renamed to tonne in CLDR 42 / ICU 72). |
public
static
final
MeasureUnit |
MICROGRAM
Constant for unit of mass: microgram |
public
static
final
MeasureUnit |
MICROMETER
Constant for unit of length: micrometer |
public
static
final
MeasureUnit |
MICROSECOND
Constant for unit of duration: microsecond |
public
static
final
MeasureUnit |
MILE
Constant for unit of length: mile |
public
static
final
MeasureUnit |
MILE_PER_GALLON
Constant for unit of consumption: mile-per-gallon |
public
static
final
MeasureUnit |
MILE_PER_GALLON_IMPERIAL
Constant for unit of consumption: mile-per-gallon-imperial |
public
static
final
MeasureUnit |
MILE_PER_HOUR
Constant for unit of speed: mile-per-hour |
public
static
final
MeasureUnit |
MILE_SCANDINAVIAN
Constant for unit of length: mile-scandinavian |
public
static
final
MeasureUnit |
MILLIAMPERE
Constant for unit of electric: milliampere |
public
static
final
MeasureUnit |
MILLIBAR
Constant for unit of pressure: millibar |
public
static
final
MeasureUnit |
MILLIGRAM
Constant for unit of mass: milligram |
public
static
final
MeasureUnit |
MILLIGRAM_OFGLUCOSE_PER_DECILITER
Constant for unit of concentr: milligram-ofglucose-per-deciliter |
public
static
final
MeasureUnit |
MILLIGRAM_PER_DECILITER
Constant for unit of concentr: milligram-per-deciliter |
public
static
final
MeasureUnit |
MILLILITER
Constant for unit of volume: milliliter |
public
static
final
MeasureUnit |
MILLIMETER
Constant for unit of length: millimeter |
public
static
final
MeasureUnit |
MILLIMETER_OF_MERCURY
Constant for unit of pressure: millimeter-ofhg |
public
static
final
MeasureUnit |
MILLIMOLE_PER_LITER
Constant for unit of concentr: millimole-per-liter |
public
static
final
MeasureUnit |
MILLISECOND
Constant for unit of duration: millisecond |
public
static
final
MeasureUnit |
MILLIWATT
Constant for unit of power: milliwatt |
public
static
final
TimeUnit |
MINUTE
Constant for unit of duration: minute |
public
static
final
TimeUnit |
MONTH
Constant for unit of duration: month |
public
static
final
MeasureUnit |
NANOMETER
Constant for unit of length: nanometer |
public
static
final
MeasureUnit |
NANOSECOND
Constant for unit of duration: nanosecond |
public
static
final
MeasureUnit |
NAUTICAL_MILE
Constant for unit of length: nautical-mile |
public
static
final
MeasureUnit |
OHM
Constant for unit of electric: ohm |
public
static
final
MeasureUnit |
OUNCE
Constant for unit of mass: ounce |
public
static
final
MeasureUnit |
OUNCE_TROY
Constant for unit of mass: ounce-troy |
public
static
final
MeasureUnit |
PARSEC
Constant for unit of length: parsec |
public
static
final
MeasureUnit |
PART_PER_MILLION
Constant for unit of concentr: permillion |
public
static
final
MeasureUnit |
PERCENT
Constant for unit of concentr: percent |
public
static
final
MeasureUnit |
PERMILLE
Constant for unit of concentr: permille |
public
static
final
MeasureUnit |
PETABYTE
Constant for unit of digital: petabyte |
public
static
final
MeasureUnit |
PICOMETER
Constant for unit of length: picometer |
public
static
final
MeasureUnit |
PINT
Constant for unit of volume: pint |
public
static
final
MeasureUnit |
PINT_METRIC
Constant for unit of volume: pint-metric |
public
static
final
MeasureUnit |
PIXEL
Constant for unit of graphics: pixel |
public
static
final
MeasureUnit |
PIXEL_PER_CENTIMETER
Constant for unit of graphics: pixel-per-centimeter |
public
static
final
MeasureUnit |
PIXEL_PER_INCH
Constant for unit of graphics: pixel-per-inch |
public
static
final
MeasureUnit |
POINT
Constant for unit of length: point |
public
static
final
MeasureUnit |
POUND
Constant for unit of mass: pound |
public
static
final
MeasureUnit |
POUND_PER_SQUARE_INCH
Constant for unit of pressure: pound-force-per-square-inch |
public
static
final
MeasureUnit |
QUART
Constant for unit of volume: quart |
public
static
final
MeasureUnit |
QUARTER
Constant for unit of duration: quarter |
public
static
final
MeasureUnit |
RADIAN
Constant for unit of angle: radian |
public
static
final
MeasureUnit |
REVOLUTION_ANGLE
Constant for unit of angle: revolution |
public
static
final
TimeUnit |
SECOND
Constant for unit of duration: second |
public
static
final
MeasureUnit |
SQUARE_CENTIMETER
Constant for unit of area: square-centimeter |
public
static
final
MeasureUnit |
SQUARE_FOOT
Constant for unit of area: square-foot |
public
static
final
MeasureUnit |
SQUARE_INCH
Constant for unit of area: square-inch |
public
static
final
MeasureUnit |
SQUARE_KILOMETER
Constant for unit of area: square-kilometer |
public
static
final
MeasureUnit |
SQUARE_METER
Constant for unit of area: square-meter |
public
static
final
MeasureUnit |
SQUARE_MILE
Constant for unit of area: square-mile |
public
static
final
MeasureUnit |
SQUARE_YARD
Constant for unit of area: square-yard |
public
static
final
MeasureUnit |
STONE
Constant for unit of mass: stone |
public
static
final
MeasureUnit |
TABLESPOON
Constant for unit of volume: tablespoon |
public
static
final
MeasureUnit |
TEASPOON
Constant for unit of volume: teaspoon |
public
static
final
MeasureUnit |
TERABIT
Constant for unit of digital: terabit |
public
static
final
MeasureUnit |
TERABYTE
Constant for unit of digital: terabyte |
public
static
final
MeasureUnit |
TON
Constant for unit of mass: ton |
public
static
final
MeasureUnit |
TONNE
Constant for unit of mass: tonne |
public
static
final
MeasureUnit |
VOLT
Constant for unit of electric: volt |
public
static
final
MeasureUnit |
WATT
Constant for unit of power: watt |
public
static
final
TimeUnit |
WEEK
Constant for unit of duration: week |
public
static
final
MeasureUnit |
YARD
Constant for unit of length: yard |
public
static
final
TimeUnit |
YEAR
Constant for unit of duration: year |
Public methods | |
---|---|
boolean
|
equals(Object rhs)
Indicates whether some other object is "equal to" this one. |
static
MeasureUnit
|
forIdentifier(String identifier)
Construct a MeasureUnit from a CLDR Core Unit Identifier, defined in UTS 35. |
static
Set<MeasureUnit>
|
getAvailable(String type)
For the given type, return the available units. |
static
Set<MeasureUnit>
|
getAvailable()
Get all of the available units. |
static
Set<String>
|
getAvailableTypes()
Get all of the available units' types. |
MeasureUnit.Complexity
|
getComplexity()
Compute the complexity of the unit. |
int
|
getDimensionality()
Returns the dimensionality (power) of this MeasureUnit. |
String
|
getIdentifier()
Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35. |
MeasureUnit.MeasurePrefix
|
getPrefix()
Returns the current SI or binary prefix of this SINGLE unit. |
String
|
getSubtype()
Get the subType, such as \u201cfoot\u201d. |
String
|
getType()
Get the type, such as "length". |
int
|
hashCode()
Returns a hash code value for the object. |
MeasureUnit
|
product(MeasureUnit other)
Computes the product of this unit with another unit. |
MeasureUnit
|
reciprocal()
Computes the reciprocal of this MeasureUnit, with the numerator and denominator flipped. |
List<MeasureUnit>
|
splitToSingleUnits()
Returns the list of SINGLE units contained within a sequence of COMPOUND units. |
String
|
toString()
Returns a string representation of the object. |
MeasureUnit
|
withDimensionality(int dimensionality)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified dimensionality (power). |
MeasureUnit
|
withPrefix(MeasureUnit.MeasurePrefix prefix)
Creates a MeasureUnit which is this SINGLE unit augmented with the specified prefix. |
Inherited methods | |
---|---|
Fields
ACRE_FOOT
public static final MeasureUnit ACRE_FOOT
Constant for unit of volume: acre-foot
AMPERE
public static final MeasureUnit AMPERE
Constant for unit of electric: ampere
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
ASTRONOMICAL_UNIT
public static final MeasureUnit ASTRONOMICAL_UNIT
Constant for unit of length: astronomical-unit
ATMOSPHERE
public static final MeasureUnit ATMOSPHERE
Constant for unit of pressure: atmosphere
BUSHEL
public static final MeasureUnit BUSHEL
Constant for unit of volume: bushel
CALORIE
public static final MeasureUnit CALORIE
Constant for unit of energy: calorie
CANDELA
public static final MeasureUnit CANDELA
Constant for unit of light: candela
CELSIUS
public static final MeasureUnit CELSIUS
Constant for unit of temperature: celsius
CENTILITER
public static final MeasureUnit CENTILITER
Constant for unit of volume: centiliter
CENTIMETER
public static final MeasureUnit CENTIMETER
Constant for unit of length: centimeter
CENTURY
public static final MeasureUnit CENTURY
Constant for unit of duration: century
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_METRIC
public static final MeasureUnit CUP_METRIC
Constant for unit of volume: cup-metric
DECADE
public static final MeasureUnit DECADE
Constant for unit of duration: decade
DECILITER
public static final MeasureUnit DECILITER
Constant for unit of volume: deciliter
DECIMETER
public static final MeasureUnit DECIMETER
Constant for unit of length: decimeter
DEGREE
public static final MeasureUnit DEGREE
Constant for unit of angle: degree
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
FAHRENHEIT
public static final MeasureUnit FAHRENHEIT
Constant for unit of temperature: fahrenheit
FATHOM
public static final MeasureUnit FATHOM
Constant for unit of length: fathom
FLUID_OUNCE
public static final MeasureUnit FLUID_OUNCE
Constant for unit of volume: fluid-ounce
FOODCALORIE
public static final MeasureUnit FOODCALORIE
Constant for unit of energy: foodcalorie
FURLONG
public static final MeasureUnit FURLONG
Constant for unit of length: furlong
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
GENERIC_TEMPERATURE
public static final MeasureUnit GENERIC_TEMPERATURE
Constant for unit of temperature: generic
GIGABIT
public static final MeasureUnit GIGABIT
Constant for unit of digital: gigabit
GIGABYTE
public static final MeasureUnit GIGABYTE
Constant for unit of digital: gigabyte
GIGAHERTZ
public static final MeasureUnit GIGAHERTZ
Constant for unit of frequency: gigahertz
GIGAWATT
public static final MeasureUnit GIGAWATT
Constant for unit of power: gigawatt
G_FORCE
public static final MeasureUnit G_FORCE
Constant for unit of acceleration: g-force
HECTARE
public static final MeasureUnit HECTARE
Constant for unit of area: hectare
HECTOLITER
public static final MeasureUnit HECTOLITER
Constant for unit of volume: hectoliter
HECTOPASCAL
public static final MeasureUnit HECTOPASCAL
Constant for unit of pressure: hectopascal
HERTZ
public static final MeasureUnit HERTZ
Constant for unit of frequency: hertz
HORSEPOWER
public static final MeasureUnit HORSEPOWER
Constant for unit of power: horsepower
INCH_HG
public static final MeasureUnit INCH_HG
Constant for unit of pressure: inch-ofhg
JOULE
public static final MeasureUnit JOULE
Constant for unit of energy: joule
KARAT
public static final MeasureUnit KARAT
Constant for unit of concentr: karat
KELVIN
public static final MeasureUnit KELVIN
Constant for unit of temperature: kelvin
KILOBIT
public static final MeasureUnit KILOBIT
Constant for unit of digital: kilobit
KILOBYTE
public static final MeasureUnit KILOBYTE
Constant for unit of digital: kilobyte
KILOCALORIE
public static final MeasureUnit KILOCALORIE
Constant for unit of energy: kilocalorie
KILOGRAM
public static final MeasureUnit KILOGRAM
Constant for unit of mass: kilogram
KILOHERTZ
public static final MeasureUnit KILOHERTZ
Constant for unit of frequency: kilohertz
KILOJOULE
public static final MeasureUnit KILOJOULE
Constant for unit of energy: kilojoule
KILOMETER
public static final MeasureUnit KILOMETER
Constant for unit of length: kilometer
KILOMETER_PER_HOUR
public static final MeasureUnit KILOMETER_PER_HOUR
Constant for unit of speed: kilometer-per-hour
KILOWATT
public static final MeasureUnit KILOWATT
Constant for unit of power: kilowatt
KILOWATT_HOUR
public static final MeasureUnit KILOWATT_HOUR
Constant for unit of energy: kilowatt-hour
KILOWATT_HOUR_PER_100_KILOMETER
public static final MeasureUnit KILOWATT_HOUR_PER_100_KILOMETER
Constant for unit of force: kilowatt-hour-per-100-kilometer
LIGHT_YEAR
public static final MeasureUnit LIGHT_YEAR
Constant for unit of length: light-year
LITER
public static final MeasureUnit LITER
Constant for unit of volume: liter
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
MEGABIT
public static final MeasureUnit MEGABIT
Constant for unit of digital: megabit
MEGABYTE
public static final MeasureUnit MEGABYTE
Constant for unit of digital: megabyte
MEGAHERTZ
public static final MeasureUnit MEGAHERTZ
Constant for unit of frequency: megahertz
MEGALITER
public static final MeasureUnit MEGALITER
Constant for unit of volume: megaliter
MEGAPIXEL
public static final MeasureUnit MEGAPIXEL
Constant for unit of graphics: megapixel
MEGAWATT
public static final MeasureUnit MEGAWATT
Constant for unit of power: megawatt
METER
public static final MeasureUnit METER
Constant for unit of length: meter
METER_PER_SECOND
public static final MeasureUnit METER_PER_SECOND
Constant for unit of speed: meter-per-second
METER_PER_SECOND_SQUARED
public static final MeasureUnit METER_PER_SECOND_SQUARED
Constant for unit of acceleration: meter-per-square-second
METRIC_TON
public static final MeasureUnit METRIC_TON
Constant for unit of mass: metric-ton (renamed to tonne in CLDR 42 / ICU 72). Note: In ICU 74 this will be deprecated in favor of TONNE, which is currently draft but will become stable in ICU 74, and which uses the preferred naming.
MICROGRAM
public static final MeasureUnit MICROGRAM
Constant for unit of mass: microgram
MICROMETER
public static final MeasureUnit MICROMETER
Constant for unit of length: micrometer
MICROSECOND
public static final MeasureUnit MICROSECOND
Constant for unit of duration: microsecond
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
MILE_PER_HOUR
public static final MeasureUnit MILE_PER_HOUR
Constant for unit of speed: mile-per-hour
MILE_SCANDINAVIAN
public static final MeasureUnit MILE_SCANDINAVIAN
Constant for unit of length: mile-scandinavian
MILLIAMPERE
public static final MeasureUnit MILLIAMPERE
Constant for unit of electric: milliampere
MILLIBAR
public static final MeasureUnit MILLIBAR
Constant for unit of pressure: millibar
MILLIGRAM
public static final MeasureUnit MILLIGRAM
Constant for unit of mass: milligram
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
MILLILITER
public static final MeasureUnit MILLILITER
Constant for unit of volume: milliliter
MILLIMETER
public static final MeasureUnit MILLIMETER
Constant for unit of length: millimeter
MILLIMETER_OF_MERCURY
public static final MeasureUnit MILLIMETER_OF_MERCURY
Constant for unit of pressure: millimeter-ofhg
MILLIMOLE_PER_LITER
public static final MeasureUnit MILLIMOLE_PER_LITER
Constant for unit of concentr: millimole-per-liter
MILLISECOND
public static final MeasureUnit MILLISECOND
Constant for unit of duration: millisecond
MILLIWATT
public static final MeasureUnit MILLIWATT
Constant for unit of power: milliwatt
MINUTE
public static final TimeUnit MINUTE
Constant for unit of duration: minute
NANOMETER
public static final MeasureUnit NANOMETER
Constant for unit of length: nanometer
NANOSECOND
public static final MeasureUnit NANOSECOND
Constant for unit of duration: nanosecond
NAUTICAL_MILE
public static final MeasureUnit NAUTICAL_MILE
Constant for unit of length: nautical-mile
OUNCE_TROY
public static final MeasureUnit OUNCE_TROY
Constant for unit of mass: ounce-troy
PARSEC
public static final MeasureUnit PARSEC
Constant for unit of length: parsec
PART_PER_MILLION
public static final MeasureUnit PART_PER_MILLION
Constant for unit of concentr: permillion
PERCENT
public static final MeasureUnit PERCENT
Constant for unit of concentr: percent
PERMILLE
public static final MeasureUnit PERMILLE
Constant for unit of concentr: permille
PETABYTE
public static final MeasureUnit PETABYTE
Constant for unit of digital: petabyte
PICOMETER
public static final MeasureUnit PICOMETER
Constant for unit of length: picometer
PINT_METRIC
public static final MeasureUnit PINT_METRIC
Constant for unit of volume: pint-metric
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
POINT
public static final MeasureUnit POINT
Constant for unit of length: point
POUND_PER_SQUARE_INCH
public static final MeasureUnit POUND_PER_SQUARE_INCH
Constant for unit of pressure: pound-force-per-square-inch
QUART
public static final MeasureUnit QUART
Constant for unit of volume: quart
QUARTER
public static final MeasureUnit QUARTER
Constant for unit of duration: quarter
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
SECOND
public static final TimeUnit SECOND
Constant for unit of duration: second
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
TABLESPOON
public static final MeasureUnit TABLESPOON
Constant for unit of volume: tablespoon
TEASPOON
public static final MeasureUnit TEASPOON
Constant for unit of volume: teaspoon
TERABIT
public static final MeasureUnit TERABIT
Constant for unit of digital: terabit
TERABYTE
public static final MeasureUnit TERABYTE
Constant for unit of digital: terabyte
Public methods
equals
public boolean equals (Object rhs)
Indicates whether some other object is "equal to" this one.
The equals
method implements an equivalence relation
on non-null object references:
- It is reflexive: for any non-null reference value
x
,x.equals(x)
should returntrue
. - It is symmetric: for any non-null reference values
x
andy
,x.equals(y)
should returntrue
if and only ify.equals(x)
returnstrue
. - It is transitive: for any non-null reference values
x
,y
, andz
, ifx.equals(y)
returnstrue
andy.equals(z)
returnstrue
, thenx.equals(z)
should returntrue
. - It is consistent: for any non-null reference values
x
andy
, multiple invocations ofx.equals(y)
consistently returntrue
or consistently returnfalse
, provided no information used inequals
comparisons on the objects is modified. - For any non-null reference value
x
,x.equals(null)
should returnfalse
.
An equivalence relation partitions the elements it operates on into equivalence classes; all the members of an equivalence class are equal to each other. Members of an equivalence class are substitutable for each other, at least for some purposes.
Parameters | |
---|---|
rhs |
Object : the reference object with which to compare. |
Returns | |
---|---|
boolean |
true if this object is the same as the obj
argument; false otherwise. |
forIdentifier
public static MeasureUnit forIdentifier (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: dimensionless MeasureUnit
is null
MeasureUnit example = MeasureUnit::forIdentifier("furlong-per-nanosecond")
Parameters | |
---|---|
identifier |
String : CLDR Unit Identifier |
Returns | |
---|---|
MeasureUnit |
Throws | |
---|---|
IllegalArgumentException |
if the identifier is invalid. |
getAvailable
public static Set<MeasureUnit> getAvailable (String type)
For the given type, return the available units.
Parameters | |
---|---|
type |
String : the type |
Returns | |
---|---|
Set<MeasureUnit> |
the available units for type. Returned set is unmodifiable. |
getAvailable
public static Set<MeasureUnit> getAvailable ()
Get all of the available units. Returned set is unmodifiable.
Returns | |
---|---|
Set<MeasureUnit> |
getAvailableTypes
public static Set<String> getAvailableTypes ()
Get all of the available units' types. Returned set is unmodifiable.
Returns | |
---|---|
Set<String> |
getComplexity
public MeasureUnit.Complexity getComplexity ()
Compute the complexity of the unit. See Complexity for more information.
Returns | |
---|---|
MeasureUnit.Complexity |
The unit complexity. |
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, Complexity
.
Returns | |
---|---|
int |
The dimensionality (power) of this simple unit. |
Throws | |
---|---|
UnsupportedOperationException |
if the unit is COMPOUND or MIXED. |
getIdentifier
public String getIdentifier ()
Get CLDR Unit Identifier for this MeasureUnit, as defined in UTS 35.
Returns | |
---|---|
String |
The string form of this 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, Complexity
.
Returns | |
---|---|
MeasureUnit.MeasurePrefix |
The prefix of this SINGLE unit, from MeasurePrefix. |
Throws | |
---|---|
UnsupportedOperationException |
if the unit is COMPOUND or MIXED. |
getSubtype
public String getSubtype ()
Get the subType, such as \u201cfoot\u201d. May return null.
Returns | |
---|---|
String |
getType
public String getType ()
Get the type, such as "length". May return null.
Returns | |
---|---|
String |
hashCode
public int hashCode ()
Returns a hash code value for the object. This method is
supported for the benefit of hash tables such as those provided by
HashMap
.
The general contract of hashCode
is:
- Whenever it is invoked on the same object more than once during
an execution of a Java application, the
hashCode
method must consistently return the same integer, provided no information used inequals
comparisons on the object is modified. This integer need not remain consistent from one execution of an application to another execution of the same application. - If two objects are equal according to the
equals
method, then calling thehashCode
method on each of the two objects must produce the same integer result. - It is not required that if two objects are unequal
according to the
equals
method, then calling thehashCode
method on each of the two objects must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal objects may improve the performance of hash tables.
Returns | |
---|---|
int |
a hash code value for this object. |
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, Complexity
.
Parameters | |
---|---|
other |
MeasureUnit : The MeasureUnit to multiply with the target. |
Returns | |
---|---|
MeasureUnit |
The product of the target unit with the provided unit. |
Throws | |
---|---|
UnsupportedOperationException |
if the unit is 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, Complexity
.
Returns | |
---|---|
MeasureUnit |
The reciprocal of the target unit. |
Throws | |
---|---|
UnsupportedOperationException |
if the unit is MIXED. |
splitToSingleUnits
public 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 | |
---|---|
List<MeasureUnit> |
An unmodifiable list of single units |
toString
public String toString ()
Returns a string representation of the object.
Returns | |
---|---|
String |
a string representation of the object. |
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, Complexity
.
Parameters | |
---|---|
dimensionality |
int : The dimensionality (power). |
Returns | |
---|---|
MeasureUnit |
A new SINGLE unit. |
Throws | |
---|---|
UnsupportedOperationException |
if the unit is COMPOUND or MIXED. |
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, Complexity
.
Parameters | |
---|---|
prefix |
MeasureUnit.MeasurePrefix : The prefix, from MeasurePrefix. |
Returns | |
---|---|
MeasureUnit |
A new SINGLE unit. |
Throws | |
---|---|
UnsupportedOperationException |
if this unit is a COMPOUND or MIXED unit. |