@Status(stage=TEST, unitTests=ABSENT) public enum MetricMass extends Enum<MetricMass>
Enum Constant and Description |
---|
GRAM
Gram.
|
KILO_GRAM
Kilo.
|
MILLIGRAM
Milligram.
|
OUNCE
Ounce (ons).
|
POUND
Pound (pond).
|
TON
Ton.
|
Modifier and Type | Field and Description |
---|---|
static int |
GRAMS_IN_KILO
Number of grams in a kilo.
|
static int |
GRAMS_IN_OUNCE
Number of grams in an ounce.
|
static int |
OUNCES_IN_POUND
Number of ounces in a pound.
|
static int |
POUNDS_IN_KILO
Number of pounds in a kilogram.
|
Modifier and Type | Method and Description |
---|---|
double |
fromGrams(double mass)
Converts the supplied mass in grams to this mass.
|
double |
fromKilos(double mass)
Converts the supplied mass in kilo's to this mass.
|
double |
toGrams(double mass)
Converts the supplied mass into grams.
|
double |
toKilos(double mass)
Converts the supplied mass into kilo's.
|
static MetricMass |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static MetricMass[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final MetricMass TON
public static final MetricMass KILO_GRAM
public static final MetricMass POUND
public static final MetricMass OUNCE
public static final MetricMass GRAM
public static final MetricMass MILLIGRAM
public static final int GRAMS_IN_OUNCE
public static final int GRAMS_IN_KILO
public static final int OUNCES_IN_POUND
public static final int POUNDS_IN_KILO
public static MetricMass[] values()
for (MetricMass c : MetricMass.values()) System.out.println(c);
public static MetricMass valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic double toKilos(double mass)
mass
- The mass to convert to kilo's.public double fromKilos(double mass)
mass
- The mass in kilo's to convert to this mass.public double toGrams(double mass)
mass
- The mass to convert to grams.public double fromGrams(double mass)
mass
- The mass in grams to convert to this mass.Copyright © 2008–2018. All rights reserved.