public abstract class Unit
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
Unit(java.lang.String name,
double value)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
static <T extends Unit> |
byName(java.lang.String unitName)
Return a unit element of a given name
|
static <T extends Unit> |
convert(double value,
T from,
T to)
Convert a measurement between two units
|
protected double |
fromBase(double n) |
java.lang.String |
getName() |
protected double |
toBase(double n) |
protected Unit(java.lang.String name,
double value)
type - name - value - public java.lang.String getName()
protected double toBase(double n)
n - protected double fromBase(double n)
n - public static <T extends Unit> double convert(double value, T from, T to)
value - to be convertedfrom - unitto - unitpublic static <T extends Unit> T byName(java.lang.String unitName)
unitName - the requested unit name© Copyright IBM 2017