public abstract class IlvUnit extends Object implements IlvPersistentObject
GetRegisteredUnit
method or listed using the
GetRegisteredUnits
method.
Unit name | Unit abbreviation | Meters per unit |
Kilometer | km | 1000 |
Meter | m | 1 |
Decimeter | dm | 0.1 |
Centimeter | cm | 0.01 |
Millimeter | mm | 0.001 |
International Nautical Mile | kmi | 1852 |
International Inch | in | 0.0254 |
International Foot | ft | 0.3048 |
International Yard | yd | 0.9144 |
International Statute Mile | mi | 1609.344 |
International Fathom | fath | 1.8288 |
International Chain | ch | 20.1168 |
International Link | link | 0.201168 |
U.S. Surveyor's Inch | us-in | 1./39.37 |
U.S. Surveyor's Foot | us-ft | 0.304800609601219 |
U.S. Surveyor's Yard | us-yd | 0.914401828803658 |
U.S. Surveyor's Chain | us-ch | 20.11684023368047 |
U.S. Surveyor's Statute Mile | us-mi | 1609.347218694437 |
Indian Yard | ind-yd | 0.91439523 |
Indian Foot | ind-ft | 0.30479841 |
Modifier | Constructor and Description |
---|---|
protected |
IlvUnit(IlvInputStream stream)
Reads the object from an
IlvInputStream object. |
protected |
IlvUnit(IlvUnit source)
Constructs a new unit by copying an existing one.
|
protected |
IlvUnit(String name,
String abbreviation)
Constructs a new unit with the specified name and abbreviation.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object object)
Returns
true if the specified object is another unit equal
to this unit. |
abstract boolean |
equivalent(IlvUnit unit)
Returns
true if the specified unit is equivalent to this
one. |
abstract double |
fromKernel(double value)
Converts the value specified in the kernel unit of the quantity measured
by this unit, to values in this unit.
|
String |
getAbbreviation()
Returns an abbreviation for the unit.
|
String |
getLocalizedAbbreviation(Locale locale)
Returns the abbreviation of the unit.
|
String |
getLocalizedName(Locale locale)
Returns the name of the unit.
|
String |
getName()
Returns the name of the unit.
|
static IlvUnit |
GetRegisteredUnit(String abbreviation)
Returns the registered unit whose abbreviation is specified as
argument.
|
static Enumeration<IlvUnit> |
GetRegisteredUnits()
Returns a list of all registered units.
|
abstract double |
toKernel(double value)
Converts the value specified in the units of this
IlvUnit to
the kernel unit (for example, meters for linear units and radians for
angular units). |
String |
toString()
Returns a string representation of this
IlvUnit . |
void |
write(IlvOutputStream stream)
Writes the object to the specified
IlvOutputStream . |
protected IlvUnit(String name, String abbreviation)
name
- The name of the unit.abbreviation
- The abbreviation of the unit.protected IlvUnit(IlvUnit source)
source
- The unit to copy.protected IlvUnit(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
object.stream
- The input stream.IlvReadFileException
- If the format is not correct.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
stream
- The stream to write this unit to.IOException
- If an I/O error occurs.public String getName()
public String getLocalizedName(Locale locale)
public String getAbbreviation()
public String getLocalizedAbbreviation(Locale locale)
public String toString()
IlvUnit
. Usually,
the representation is the abbreviation of a unit.public abstract double toKernel(double value)
IlvUnit
to
the kernel unit (for example, meters for linear units and radians for
angular units).value
- The value to convert.public abstract double fromKernel(double value)
value
- The value expressed in kernel units.public abstract boolean equivalent(IlvUnit unit)
true
if the specified unit is equivalent to this
one.
Two units are equivalent if :
unit
- The unit to compare to.true
if the two units are equivalent.public boolean equals(Object object)
true
if the specified object is another unit equal
to this unit.
This default implementation returns true
if the two units
are equivalent and if they have the same name and abbreviations.public static IlvUnit GetRegisteredUnit(String abbreviation)
abbreviation
- The abbreviation of the measurement unit.null
if the unit converter is not registered.GetRegisteredUnits()
public static Enumeration<IlvUnit> GetRegisteredUnits()
IlvLinearUnit
.GetRegisteredUnit(java.lang.String)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.