public class LabelUnit extends Object implements Comparable<LabelUnit>
| Constructor and Description |
|---|
LabelUnit(String name,
double factor)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(LabelUnit other) |
static String |
formatValue(double value,
double eps,
LabelUnit[] units)
Formats a given number giving its value in a sensible precision
using a suitable unit.
|
double |
getFactor()
Returns the size of this unit in terms of some standard unit.
|
String |
getName()
Returns this unit's name as used for annotating values.
|
static LabelUnit |
getUnit(double value,
LabelUnit[] units)
Returns an appropriate unit for annotating the given value.
|
public LabelUnit(String name, double factor)
name - human-readable unit name for annotating valuesfactor - size of this unit in terms of some standard unitpublic String getName()
public double getFactor()
public int compareTo(LabelUnit other)
compareTo in interface Comparable<LabelUnit>public static LabelUnit getUnit(double value, LabelUnit[] units)
value - value in standard unitsunits - list of available unitspublic static String formatValue(double value, double eps, LabelUnit[] units)
value - numeric value in standard unitseps - approximate precision of value in standard unitsunits - list of available unitsCopyright © 2025 Central Laboratory of the Research Councils. All Rights Reserved.