public enum WeightUnit extends java.lang.Enum<WeightUnit> implements UnitEnum<WeightUnit>
Enum Constant and Description |
---|
CWT
Weights in hundreds of pounds-mass.
|
KILOGRAM
Weights in kilograms.
|
LONG_TON
Weights in long tons.
|
METRIC_TON
Weights in metric tons.
|
PERSON
Weights in number of average-sized adult human beings.
|
POUND
Weights in pounds.
|
TON
Weights in short tons,
|
Modifier and Type | Method and Description |
---|---|
float |
from(WeightUnit other)
Get the multiplicative conversion factor to convert a weight from the specified
units to this unit.
|
java.lang.String |
getAbbreviation()
Get short standard abbreviations for this WeightUnit.
|
static WeightUnit[] |
getHeavyWeightUnits()
Get the units of weight that are "heavy" (enough for a motorized vehicle).
|
float |
getOffset(WeightUnit other)
Get the additive offset to convert a value from the specified unit to this unit.
|
static WeightUnit |
getUnitForName(java.lang.String name)
Get the enumeration corresponding to the specified weight unit String name.
|
static WeightUnit |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static WeightUnit[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final WeightUnit POUND
public static final WeightUnit KILOGRAM
public static final WeightUnit CWT
public static final WeightUnit PERSON
public static final WeightUnit TON
public static final WeightUnit METRIC_TON
public static final WeightUnit LONG_TON
public static WeightUnit[] values()
for (WeightUnit c : WeightUnit.values()) System.out.println(c);
public static WeightUnit valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is nullpublic final float from(WeightUnit other)
from
in interface UnitEnum<WeightUnit>
other
- another WeightUnit representing the existing units of a Weight valuepublic float getOffset(WeightUnit other)
getOffset
in interface UnitEnum<WeightUnit>
other
- another WeightUnit representing the existing units of a valuepublic java.lang.String getAbbreviation()
public static WeightUnit getUnitForName(java.lang.String name)
name
- String to convert inti a WeightUnitpublic static WeightUnit[] getHeavyWeightUnits()