|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.vizzini.math.UnitConverter
public class UnitConverter
Provides convenience methods related to unit conversion.
Field Summary | |
---|---|
static String |
AU
Astronomical units constant. |
static String |
DAYS
Days constant. |
static String |
DEGREES
Degrees constant. |
static String |
FT
Feet constant. |
static String |
HOURS
Hours constant. |
static String |
KG
Kilogram constant. |
static String |
KM
Kilometers constant. |
static String |
M
Meters constant. |
static String |
MIN
Minutes constant. |
static String |
MW
Mega-Watts constant. |
static String |
RADIANS
Radians constant. |
static String |
SEC
Seconds constant. |
static String |
YEARS
Years constant. |
Method Summary | |
---|---|
double |
convert(double value,
String fromUnits,
String toUnits)
Convert the given value to the new units. |
double |
convertString(String valueAndUnitsStr,
String toUnits)
Return the value given by the string in the desired units. |
static UnitConverter |
getInstance()
Return the singleton instance of this class. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String DEGREES
public static final String RADIANS
public static final String AU
public static final String FT
public static final String M
public static final String KM
public static final String YEARS
public static final String DAYS
public static final String HOURS
public static final String MIN
public static final String SEC
public static final String MW
public static final String KG
Method Detail |
---|
public static UnitConverter getInstance()
public double convert(double value, String fromUnits, String toUnits)
value
- Value to convert.fromUnits
- Current value units.toUnits
- Desired units.
public double convertString(String valueAndUnitsStr, String toUnits)
valueAndUnitsStr
- String which provides the value, and optionally
the units (separated by a space). For example,
"1.99e30 kg".toUnits
- Desired units.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2007 Vizzini.org. All Rights Reserved. | 2007.12.25.03.00.02 |