MeasureUnit

public class MeasureUnit extends Object
implements Serializable
Known Direct Subclasses

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

Field Summary

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 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 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 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 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 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-hg
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 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-100kilometers
public static final MeasureUnit LITER_PER_KILOMETER Constant for unit of consumption: liter-per-kilometer
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 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-second-squared
public static final MeasureUnit METRIC_TON Constant for unit of mass: metric-ton
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_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 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-of-mercury
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 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 POUND Constant for unit of mass: pound
public static final MeasureUnit POUND_PER_SQUARE_INCH Constant for unit of pressure: pound-per-square-inch
public static final MeasureUnit QUART Constant for unit of volume: quart
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 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 Method Summary

boolean
equals(Object rhs)
Compares this instance with the specified object and indicates if they are equal.
synchronized static Set<MeasureUnit>
getAvailable()
Get all of the available units.
synchronized static Set<MeasureUnit>
getAvailable(String type)
For the given type, return the available units.
synchronized static Set<String>
getAvailableTypes()
Get all of the available units' types.
String
getSubtype()
Get the subType, such as “foot”.
String
getType()
Get the type, such as "length"
int
hashCode()
Returns an integer hash code for this object.
String
toString()
Returns a string containing a concise, human-readable description of this object.

Inherited Method 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 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 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 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 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 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-hg

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 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-100kilometers

public static final MeasureUnit LITER_PER_KILOMETER

Constant for unit of consumption: liter-per-kilometer

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 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-second-squared

public static final MeasureUnit METRIC_TON

Constant for unit of mass: metric-ton

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_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 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-of-mercury

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 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 POUND

Constant for unit of mass: pound

public static final MeasureUnit POUND_PER_SQUARE_INCH

Constant for unit of pressure: pound-per-square-inch

public static final MeasureUnit QUART

Constant for unit of volume: quart

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 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

public boolean equals (Object rhs)

Compares this instance with the specified object and indicates if they are equal. In order to be equal, o must represent the same object as this instance using a class-specific comparison. The general contract is that this comparison should be reflexive, symmetric, and transitive. Also, no object reference other than null is equal to null.

The default implementation returns true only if this == o. See Writing a correct equals method if you intend implementing your own equals method.

The general contract for the equals and hashCode() methods is that if equals returns true for any two objects, then hashCode() must return the same value for these objects. This means that subclasses of Object usually override either both methods or neither of them.

Parameters
rhs the object to compare this instance with.
Returns
  • true if the specified object is equal to this Object; false otherwise.

public static synchronized Set<MeasureUnit> getAvailable ()

Get all of the available units. Returned set is unmodifiable.

public static synchronized Set<MeasureUnit> getAvailable (String type)

For the given type, return the available units.

Parameters
type the type
Returns
  • the available units for type. Returned set is unmodifiable.

public static synchronized Set<String> getAvailableTypes ()

Get all of the available units' types. Returned set is unmodifiable.

public String getSubtype ()

Get the subType, such as “foot”.

public String getType ()

Get the type, such as "length"

public int hashCode ()

Returns an integer hash code for this object. By contract, any two objects for which equals(Object) returns true must return the same hash code value. This means that subclasses of Object usually override both methods or neither method.

Note that hash values must not change over time unless information used in equals comparisons also changes.

See Writing a correct hashCode method if you intend implementing your own hashCode method.

Returns
  • this object's hash code.

public String toString ()

Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:

   getClass().getName() + '@' + Integer.toHexString(hashCode())

See Writing a useful toString method if you intend implementing your own toString method.

Returns
  • a printable representation of this object.