public static class NavigatableComponent.SystemOfMeasurement extends Object
Modifier and Type | Field and Description |
---|---|
String |
aName
First unit used to format text.
|
String |
areaCustomName
Specific optional area unit.
|
double |
areaCustomValue
Specific optional area value, in squared meters, between
aValue*aValue and bValue*bValue . |
double |
aValue
First value, in meters, used to translate unit according to above formula.
|
String |
bName
Second unit used to format text.
|
double |
bValue
Second value, in meters, used to translate unit according to above formula.
|
Constructor and Description |
---|
SystemOfMeasurement(double aValue,
String aName,
double bValue,
String bName)
System of measurement.
|
SystemOfMeasurement(double aValue,
String aName,
double bValue,
String bName,
double areaCustomValue,
String areaCustomName)
System of measurement.
|
Modifier and Type | Method and Description |
---|---|
private static String |
formatText(double v,
String unit,
NumberFormat format) |
String |
getAreaText(double area)
Returns the text describing the given area in this system of measurement.
|
String |
getAreaText(double area,
NumberFormat format,
double threshold)
Returns the text describing the given area in this system of measurement.
|
String |
getDistText(double dist)
Returns the text describing the given distance in this system of measurement.
|
String |
getDistText(double dist,
NumberFormat format,
double threshold)
Returns the text describing the given distance in this system of measurement.
|
public final double aValue
public final double bValue
public final double areaCustomValue
aValue*aValue
and bValue*bValue
. Set to -1
if not used.public final String areaCustomName
null
if not used.public SystemOfMeasurement(double aValue, String aName, double bValue, String bName)
aValue
- First value, in meters, used to translate unit according to above formula.aName
- First unit used to format text.bValue
- Second value, in meters, used to translate unit according to above formula.bName
- Second unit used to format text.public SystemOfMeasurement(double aValue, String aName, double bValue, String bName, double areaCustomValue, String areaCustomName)
aValue
- First value, in meters, used to translate unit according to above formula.aName
- First unit used to format text.bValue
- Second value, in meters, used to translate unit according to above formula.bName
- Second unit used to format text.areaCustomValue
- Specific optional area value, in squared meters, between aValue*aValue
and bValue*bValue
.
Set to -1
if not used.areaCustomName
- Specific optional area unit. Set to null
if not used.public String getDistText(double dist)
dist
- The distance in metrespublic String getDistText(double dist, NumberFormat format, double threshold)
dist
- The distance in metresformat
- A NumberFormat
to format the area valuethreshold
- Values lower than this threshold
are displayed as "< [threshold]"
public String getAreaText(double area)
area
- The area in square metrespublic String getAreaText(double area, NumberFormat format, double threshold)
area
- The area in square metresformat
- A NumberFormat
to format the area valuethreshold
- Values lower than this threshold
are displayed as "< [threshold]"
private static String formatText(double v, String unit, NumberFormat format)