wt.units
Class Unit

java.lang.Object
  extended bywt.units.Unit
All Implemented Interfaces:
Cloneable, Externalizable, Serializable

public class Unit
extends Object
implements Cloneable, Externalizable

This Class represents a floating point number with units. It has support for basic arithmetic operations and unit conversions. It stores the floating point number at 'double' precision and maintains a record of significant figures across operations and conversions.

Supported API: false

Extendable: false

See Also:
Serialized Form

Field Summary
static Unit ACRE
           
static String ACRE_SYMBOL
           
static Unit AMPERE
           
static String AMPERE_SYMBOL
           
static Unit ANGSTROM
           
static String ANGSTROM_SYMBOL
           
static Unit ARCMIN
           
static String ARCMIN_SYMBOL
           
static Unit ARCSEC
           
static String ARCSEC_SYMBOL
           
static Unit ARE
           
static String ARE_SYMBOL
           
static Unit ATM
           
static String ATM_SYMBOL
           
static Unit ATOMIC_MASS
           
static String ATOMIC_MASS_SYMBOL
           
static String ATTO_PREFIX
           
static Unit AU
           
static String AU_SYMBOL
           
static Unit BAR
           
static String BAR_SYMBOL
           
static Unit BARN
           
static String BARN_SYMBOL
           
static Unit BARREL
           
static String BARREL_SYMBOL
           
static String[] BASE_SYMBOLS
          The base symbols used for internal unit storage.
private  int[] baseUnits
           
static Unit BECQUEREL
           
static String BECQUEREL_SYMBOL
           
static Unit BIT
           
static String BIT_SYMBOL
           
static Unit BOARD_FOOT
           
static String BOARD_FOOT_SYMBOL
           
static Unit BTU
           
static String BTU_SYMBOL
           
static Unit BYTE
           
static String BYTE_SYMBOL
           
static Unit CALORIE
           
static String CALORIE_SYMBOL
           
static Unit CANADIAN_GALLON
           
static String CANADIAN_GALLON_SYMBOL
           
static Unit CANDELA
           
static String CANDELA_SYMBOL
           
static Unit CARAT
           
static String CARAT_SYMBOL
           
static String CENTI_PREFIX
           
static Unit CHAIN
           
static String CHAIN_SYMBOL
           
private static String CLASSNAME
           
static char CLOSE_PARENTHESIS_CHAR
           
static Unit COULOMB
           
static String COULOMB_SYMBOL
           
static Unit CURIE
           
static String CURIE_SYMBOL
           
static Unit DAY
           
static String DAY_SYMBOL
           
static String DECI_PREFIX
           
static Unit DEG_FAHRENHEIT
           
static double DEG_FAHRENHEIT_ADDITIVE_CONSTANT
           
static String DEG_FAHRENHEIT_SYMBOL
           
static Unit DEGREE
           
static Unit DEGREE_CELSIUS
           
static double DEGREE_CELSIUS_ADDITIVE_CONSTANT
           
static String DEGREE_CELSIUS_SYMBOL
           
static Unit DEGREE_RANKINE
           
static String DEGREE_RANKINE_SYMBOL
           
static String DEGREE_SYMBOL
           
static String DEKA_PREFIX
           
static char DIVIDE_CHAR
           
static Unit DYNE
           
static String DYNE_SYMBOL
           
static Unit EEC_THERM
           
static String EEC_THERM_SYMBOL
           
static Unit ELECTRON_VOLT
           
static String ELECTRON_VOLT_SYMBOL
           
static Unit ERG
           
static String ERG_SYMBOL
           
static String EXA_PREFIX
           
static long EXTERNALIZATION_VERSION_UID
           
static Unit FARAD
           
static String FARAD_SYMBOL
           
static Unit FARADAY
           
static String FARADAY_SYMBOL
           
static Unit FATHOM
           
static String FATHOM_SYMBOL
           
static String FEMTO_PREFIX
           
static Unit FERMI
           
static String FERMI_SYMBOL
           
static Unit FOOT
           
static String FOOT_SYMBOL
           
static Unit FOOTCANDLE
           
static String FOOTCANDLE_SYMBOL
           
static Unit FOOTLAMBERT
           
static String FOOTLAMBERT_SYMBOL
           
static String GIGA_PREFIX
           
static Unit GRADE
           
static String GRADE_SYMBOL
           
static Unit GRAIN
           
static String GRAIN_SYMBOL
           
static Unit GRAM
           
static Unit GRAM_FORCE
           
static String GRAM_FORCE_SYMBOL
           
static String GRAM_SYMBOL
           
static Unit GRAY
           
static String GRAY_SYMBOL
           
static Unit HECTARE
           
static String HECTARE_SYMBOL
           
static String HECTO_PREFIX
           
static String HECTO_PREFIX_ALT
           
static Unit HENRY
           
static String HENRY_SYMBOL
           
static Unit HERTZ
           
static String HERTZ_SYMBOL
           
static Unit HORSEPOWER
           
static String HORSEPOWER_SYMBOL
           
static Unit HOUR
           
static String HOUR_SYMBOL
           
static Unit INCH
           
static String INCH_SYMBOL
           
static Unit INCHES_MERCURY_60DEG_F
           
static String INCHES_MERCURY_60DEG_F_SYMBOL
           
static Unit INCHES_MERCURY_ZERO_C
           
static String INCHES_MERCURY_ZERO_C_SYMBOL
           
static Unit JOULE
           
static String JOULE_SYMBOL
           
static Unit KELVIN
           
static String KELVIN_SYMBOL
           
static String KILO_PREFIX
           
static String KILO_PREFIX_ALT
           
static Unit KILOGRAM
           
static String KILOGRAM_SYMBOL
           
static Unit KILOMETERS_PER_H
           
static String KILOMETERS_PER_H_SYMBOL
           
static Unit KILOPOUND_FORCE
           
static String KILOPOUND_FORCE_SYMBOL
           
static Unit LAMBERT
           
static String LAMBERT_SYMBOL
           
static Unit LIGHT_YEAR
           
static String LIGHT_YEAR_SYMBOL
           
static Unit LITER
           
static String LITER_SYMBOL
           
static Unit LONG_TON_UK
           
static String LONG_TON_UK_SYMBOL
           
static Unit LUMEN
           
static String LUMEN_SYMBOL
           
static Unit LUX
           
static String LUX_SYMBOL
           
static int MAX_SIG_FIGS
          The maximum number of digits within the value that can be considered significant.
static String MEGA_PREFIX
           
static Unit METER
           
static String METER_SYMBOL
           
static Unit METERS_MERCURY_ZERO_C
           
static String METERS_MERCURY_ZERO_C_SYMBOL
           
static Unit METRIC_TON
           
static String METRIC_TON_SYMBOL
           
static Unit MHO
           
static String MHO_SYMBOL
           
static String MICRO_PREFIX
           
static Unit MICRON
           
static String MICRON_SYMBOL
           
static Unit MIL
           
static String MIL_SYMBOL
           
static Unit MILE
           
static String MILE_SYMBOL
           
static Unit MILES_PER_GALLON
           
static String MILES_PER_GALLON_SYMBOL
           
static Unit MILES_PER_HOUR
           
static String MILES_PER_HOUR_SYMBOL
           
static String MILLI_PREFIX
           
static Unit MINUTE
           
static String MINUTE_SYMBOL
           
static Unit MOLE
           
static String MOLE_SYMBOL
           
static char MULTIPLY_CHAR
           
static String NANO_PREFIX
           
static Unit NAUTICAL_MILE
           
static String NAUTICAL_MILE_SYMBOL
           
static Unit NAUTICAL_MPH
           
static String NAUTICAL_MPH_SYMBOL
           
static Unit NEWTON
           
static String NEWTON_SYMBOL
           
static Unit NIBBLE
           
static String NIBBLE_SYMBOL
           
static Unit OHM
           
static String OHM_SYMBOL
           
protected static long OLD_FORMAT_VERSION_UID
           
static char OPEN_PARENTHESIS_CHAR
           
static Unit OUNCE
           
static String OUNCE_SYMBOL
           
static Unit PARSEC
           
static String PARSEC_SYMBOL
           
static Unit PASCAL
           
static String PASCAL_SYMBOL
           
static Unit PECK
           
static String PECK_SYMBOL
           
static String PETA_PREFIX
           
static Unit PHOT
           
static String PHOT_SYMBOL
           
static String PICO_PREFIX
           
static Unit PINT
           
static Unit PINT_DRY
           
static String PINT_DRY_SYMBOL
           
static String PINT_SYMBOL
           
static Unit POISE
           
static String POISE_SYMBOL
           
static Unit POUND
           
static Unit POUND_FORCE
           
static Unit POUND_FORCE_ALT
           
static String POUND_FORCE_ALT_SYMBOL
           
static String POUND_FORCE_SYMBOL
           
static String POUND_SYMBOL
           
static Unit POUNDAL
           
static String POUNDAL_SYMBOL
           
static char POWER_CHAR
           
private static Hashtable prefixTable
           
static Unit PSI
           
static String PSI_SYMBOL
           
static Unit QUART
           
static Unit QUART_DRY
           
static String QUART_DRY_SYMBOL
           
static String QUART_SYMBOL
           
static Unit RAD
           
static String RAD_SYMBOL
           
static Unit RADIAN
           
static Unit RADIAN_ALT
           
static String RADIAN_ALT_SYMBOL
           
static String RADIAN_SYMBOL
           
static Unit REM
           
static String REM_SYMBOL
           
private static String RESOURCE
           
static Unit REVOLUTION
           
static String REVOLUTION_SYMBOL
           
static Unit ROD
           
static String ROD_SYMBOL
           
static Unit ROENTGEN
           
static String ROENTGEN_SYMBOL
           
static Unit RPM
           
static String RPM_SYMBOL
           
static Unit SECOND
           
static String SECOND_SYMBOL
           
(package private) static long serialVersionUID
           
static Unit SHORT_TON_US
           
static String SHORT_TON_US_SYMBOL
           
static Unit SIEMENS
           
static String SIEMENS_SYMBOL
           
static Unit SIEVERT
           
static String SIEVERT_SYMBOL
           
private  int sigFigs
           
static Unit SLUG
           
static String SLUG_SYMBOL
           
static Unit SPEED_OF_LIGHT
           
static String SPEED_OF_LIGHT_SYMBOL
           
static Unit STANDARD_GRAVITY
           
static String STANDARD_GRAVITY_SYMBOL
           
static Unit STERADIAN
           
static String STERADIAN_SYMBOL
           
static Unit STERE
           
static String STERE_SYMBOL
           
static Unit STILB
           
static String STILB_SYMBOL
           
static Unit STOKES
           
static String STOKES_SYMBOL
           
static Unit SURVEY_FOOT
           
static String SURVEY_FOOT_SYMBOL
           
private static Hashtable symbolTable
           
private static Hashtable systemTable
           
static Unit TABLESPOON
           
static String TABLESPOON_SYMBOL
           
static Unit TEASPOON
           
static String TEASPOON_SYMBOL
           
static String TERA_PREFIX
           
static Unit TESLA
           
static String TESLA_SYMBOL
           
static Unit TORR
           
static String TORR_SYMBOL
           
static Unit TROY_OUNCE
           
static String TROY_OUNCE_SYMBOL
           
static Unit TROY_POUND
           
static String TROY_POUND_SYMBOL
           
static Unit UK_FLUID_OUNCE
           
static String UK_FLUID_OUNCE_SYMBOL
           
static Unit UK_GALLON
           
static String UK_GALLON_SYMBOL
           
static Unit UNITLESS
           
static String UNITLESS_SYMBOL
           
private  String unknownUnits
           
static Unit US_BUSHEL
           
static String US_BUSHEL_SYMBOL
           
static Unit US_CUP
           
static String US_CUP_SYMBOL
           
static Unit US_FLUID_OUNCE
           
static String US_FLUID_OUNCE_SYMBOL
           
static Unit US_GALLON
           
static String US_GALLON_SYMBOL
           
static Unit US_GILL
           
static String US_GILL_SYMBOL
           
static Unit US_MILE
           
static String US_MILE_SYMBOL
           
private  double value
           
static Unit VOLT
           
static String VOLT_SYMBOL
           
static Unit WATT
           
static String WATT_SYMBOL
           
static Unit WEBER
           
static String WEBER_SYMBOL
           
static Unit WEEK
           
static String WEEK_SYMBOL
           
static Unit YARD
           
static String YARD_SYMBOL
           
static Unit YEAR
           
static String YEAR_SYMBOL
           
static String YOCTO_PREFIX
           
static String YOTTA_PREFIX
           
static String ZEPTO_PREFIX
           
static String ZETTA_PREFIX
           
 
Constructor Summary
  Unit()
          

Supported API: false
private Unit(double valueDouble, int sigFigs, int A, int cd, int kg, int K, int m, int mol, int r, int s, int sr, int B)
           
  Unit(double valueDouble, int sigFigs, String unitString)
          

Supported API: false
  Unit(double valueDouble, String unitString)
          

Supported API: false
  Unit(String valueString, int sigFigs, String unitString)
          

Supported API: false
  Unit(String valueString, String unitString)
          

Supported API: false
 
Method Summary
 void add(Unit unitB)
          Adds the specified Unit to this Unit.
 Object clone()
          Returns a clone of this Unit.
 boolean compatible(String unitString)
          Returns true if the units represented by the specified units string are compatible with those of this Unit.
 boolean compatible(Unit unitB)
          Returns true if the units of the specified Unit are compatible with those of this Unit.
 boolean containsUnknownUnits()
          Returns true if this Unit contains any unknown units.
 double convert(String unitString)
          Returns a double representing the value of this Unit when converted to the units represented by the specified units string.
 String convertToString(String unitString, int displayDigits)
          Returns a string representing the value of this Unit when converted to the units represented by the specified units string, with the specified number of digits.
private static int countSigFigs(String valueString)
          Returns the number of significant figures that exist in the specified string representation of a floating point number.
 void divide(Unit unitB)
          Divides this Unit by the specified Unit.
private  String doubleToString(double doubleValue, int numDigits)
          Returns a string representation of the specified double rounded to the specified number of digits.
 boolean equals(Object obj)
          Returns true if the specified object is an instance of Unit that has units that are compatible with those of this Unit, that has the same number of significant figues as this Unit, and that has a value equal to that of this unit when rounded to significant figures.
 Unit factor(String unitString)
          Returns a Unit representing the result of factoring this Unit by the units represented by the specified units string.
private  int getCloseIndex(char[] unitChars, int startIndex)
          Returns the index of the first occurrance of the CLOSE_PARENTHESIS character in the specified character array, starting at the specified start index.
private  String getKnownUnits(String[] systemSymbols)
          Returns a units string composed of the specified symbols and representing the portion of the units of this Unit that are not unknown.
 Unit getMaximumRoundingEquivalent()
          Returns a Unit with the maximum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.
 Unit getMaximumRoundingEquivalent(int roundingDigits)
          Returns a Unit with the maximum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits.
 Unit getMinimumRoundingEquivalent()
          Returns a Unit with the minimum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.
 Unit getMinimumRoundingEquivalent(int roundingDigits)
          Returns a Unit with the minimum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits.
 int getSigFigs()
          Gets the value of the attribute: sigFigs; The number of digits within the value that can be considered significant.
private  String[] getSystemSymbols(Hashtable symbolMap)
          Returns the set of base symbols that corresponds to the specified symbol map.
 String getUnits()
          Gets the value of the attribute: units; A derived attribute that generates String based accessors to the units.
 String getUnits(Hashtable symbolMap)
          Returns a string representation of the units of this Unit, composed of the base symbols corresponding to the specified symbol map.
private  String getUnits(String[] systemSymbols)
          Returns a string representation of the units of this Unit, composed of the specified base symbols.
 double getValue()
          Gets the value of the attribute: value; The floating point value.
 String getValueString()
          Returns the value of this Unit as a string with MAX_SIG_FIGS digits.
 String getValueString(Hashtable symbolMap, int displayDigits)
          Returns a string representation of the value of this Unit with the specified number of digits, after conversion to units represented by the base symbols corresponding to the specified symbol map.
private  String getValueString(String[] systemSymbols, int displayDigits)
          Returns a string representation of the value of this Unit with the specified number of digits, after conversion to units represented by the specified base symbols.
 int hashCode()
           
private  void loadTables()
          Loads the internal symbol table and prefix table that are used for unit conversions.
static Unit lookupSymbol(String symbol)
          Returns a Unit corresponding to the specified symbol string.
 void multiply(Unit unitB)
          Multiplies this Unit by the specified Unit.
 void multiply(Unit unitB, int power)
          Multiplies this Unit by the specified Unit raised to the specified power.
private  Unit parseUnit(char[] unitChars, int startIndex, int endIndex)
          Returns a Unit corresponding to the results of parsing the specified character array from the specified start index to the specified end index.
 void pow(int power)
          Raises this Unit to the specified power.
 void readExternal(ObjectInput input)
          Reads the non-transient fields of this class from an external source.
private  boolean readOldVersion(ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source, which is not the current version.
protected  boolean readVersion(Unit thisObject, ObjectInput input, long readSerialVersionUID, boolean passThrough, boolean superDone)
          Reads the non-transient fields of this class from an external source.
private  double roundingEquivalent(double doubleValue, int roundingDigits, int roundingDirection)
          Returns the largest or smallest double that, when rounded to the specified number of digits, is equal to the specified double rounded to the same number of digits.
 void scale(double scale)
          Scales this Unit by the specified value.
 void setSigFigs(int a_SigFigs)
          Sets the value of the attribute: sigFigs; The number of digits within the value that can be considered significant.
protected  void setUnits(String a_Units)
          Sets the value of the attribute: units; A derived attribute that generates String based accessors to the units.
 void setValue(double a_Value)
          Sets the value of the attribute: value; The floating point value.
 void subtract(Unit unitB)
          Subtracts the specified Unit from this Unit.
 String toString()
          Return a string equivalent to getValueString() + " " + getUnits().
 String toString(Hashtable symbolMap, int displayDigits)
          Return a string equivalent to getValueString(symbolMap,displayDigits) + " " + getUnits(symbolMap,displayDigits).
private  String toString(String[] systemSymbols, int displayDigits)
          Return a string equivalent to getValueString(systemSymbols,displayDigits) + " " + getUnits(systemSymbols,displayDigits).
 void writeExternal(ObjectOutput output)
          Writes the non-transient fields of this class to an external source.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RESOURCE

private static final String RESOURCE
See Also:
Constant Field Values

CLASSNAME

private static final String CLASSNAME

BASE_SYMBOLS

public static final String[] BASE_SYMBOLS
The base symbols used for internal unit storage. Statically initialized to the set of internal keys used in the base symbol resource bundles.

Supported API: false

See Also:
BaseSymbolRB

MAX_SIG_FIGS

public static final int MAX_SIG_FIGS
The maximum number of digits within the value that can be considered significant.

Supported API: false

See Also:
Constant Field Values

symbolTable

private static Hashtable symbolTable

prefixTable

private static Hashtable prefixTable

systemTable

private static Hashtable systemTable

value

private double value

sigFigs

private int sigFigs

baseUnits

private int[] baseUnits

unknownUnits

private String unknownUnits

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values

EXTERNALIZATION_VERSION_UID

public static final long EXTERNALIZATION_VERSION_UID
See Also:
Constant Field Values

OLD_FORMAT_VERSION_UID

protected static final long OLD_FORMAT_VERSION_UID
See Also:
Constant Field Values

OPEN_PARENTHESIS_CHAR

public static final char OPEN_PARENTHESIS_CHAR
See Also:
Constant Field Values

CLOSE_PARENTHESIS_CHAR

public static final char CLOSE_PARENTHESIS_CHAR
See Also:
Constant Field Values

MULTIPLY_CHAR

public static final char MULTIPLY_CHAR
See Also:
Constant Field Values

DIVIDE_CHAR

public static final char DIVIDE_CHAR
See Also:
Constant Field Values

POWER_CHAR

public static final char POWER_CHAR
See Also:
Constant Field Values

YOTTA_PREFIX

public static final String YOTTA_PREFIX
See Also:
Constant Field Values

ZETTA_PREFIX

public static final String ZETTA_PREFIX
See Also:
Constant Field Values

EXA_PREFIX

public static final String EXA_PREFIX
See Also:
Constant Field Values

PETA_PREFIX

public static final String PETA_PREFIX
See Also:
Constant Field Values

TERA_PREFIX

public static final String TERA_PREFIX
See Also:
Constant Field Values

GIGA_PREFIX

public static final String GIGA_PREFIX
See Also:
Constant Field Values

MEGA_PREFIX

public static final String MEGA_PREFIX
See Also:
Constant Field Values

KILO_PREFIX

public static final String KILO_PREFIX
See Also:
Constant Field Values

KILO_PREFIX_ALT

public static final String KILO_PREFIX_ALT
See Also:
Constant Field Values

HECTO_PREFIX

public static final String HECTO_PREFIX
See Also:
Constant Field Values

HECTO_PREFIX_ALT

public static final String HECTO_PREFIX_ALT
See Also:
Constant Field Values

DEKA_PREFIX

public static final String DEKA_PREFIX
See Also:
Constant Field Values

DECI_PREFIX

public static final String DECI_PREFIX
See Also:
Constant Field Values

CENTI_PREFIX

public static final String CENTI_PREFIX
See Also:
Constant Field Values

MILLI_PREFIX

public static final String MILLI_PREFIX
See Also:
Constant Field Values

MICRO_PREFIX

public static final String MICRO_PREFIX
See Also:
Constant Field Values

NANO_PREFIX

public static final String NANO_PREFIX
See Also:
Constant Field Values

PICO_PREFIX

public static final String PICO_PREFIX
See Also:
Constant Field Values

FEMTO_PREFIX

public static final String FEMTO_PREFIX
See Also:
Constant Field Values

ATTO_PREFIX

public static final String ATTO_PREFIX
See Also:
Constant Field Values

ZEPTO_PREFIX

public static final String ZEPTO_PREFIX
See Also:
Constant Field Values

YOCTO_PREFIX

public static final String YOCTO_PREFIX
See Also:
Constant Field Values

DEGREE_CELSIUS_ADDITIVE_CONSTANT

public static final double DEGREE_CELSIUS_ADDITIVE_CONSTANT
See Also:
Constant Field Values

DEG_FAHRENHEIT_ADDITIVE_CONSTANT

public static final double DEG_FAHRENHEIT_ADDITIVE_CONSTANT
See Also:
Constant Field Values

UNITLESS

public static final Unit UNITLESS

AMPERE

public static final Unit AMPERE

ARE

public static final Unit ARE

ACRE

public static final Unit ACRE

ANGSTROM

public static final Unit ANGSTROM

ARCMIN

public static final Unit ARCMIN

ARCSEC

public static final Unit ARCSEC

ATM

public static final Unit ATM

ATOMIC_MASS

public static final Unit ATOMIC_MASS

AU

public static final Unit AU

BARN

public static final Unit BARN

BAR

public static final Unit BAR

BARREL

public static final Unit BARREL

BECQUEREL

public static final Unit BECQUEREL

BTU

public static final Unit BTU

BIT

public static final Unit BIT

BYTE

public static final Unit BYTE

US_BUSHEL

public static final Unit US_BUSHEL

SPEED_OF_LIGHT

public static final Unit SPEED_OF_LIGHT

COULOMB

public static final Unit COULOMB

CALORIE

public static final Unit CALORIE

CANDELA

public static final Unit CANDELA

CHAIN

public static final Unit CHAIN

CURIE

public static final Unit CURIE

CARAT

public static final Unit CARAT

US_CUP

public static final Unit US_CUP

DAY

public static final Unit DAY

DEGREE

public static final Unit DEGREE

DEGREE_CELSIUS

public static final Unit DEGREE_CELSIUS

DEG_FAHRENHEIT

public static final Unit DEG_FAHRENHEIT

DEGREE_RANKINE

public static final Unit DEGREE_RANKINE

DYNE

public static final Unit DYNE

ERG

public static final Unit ERG

ELECTRON_VOLT

public static final Unit ELECTRON_VOLT

FARAD

public static final Unit FARAD

FATHOM

public static final Unit FATHOM

BOARD_FOOT

public static final Unit BOARD_FOOT

FOOTCANDLE

public static final Unit FOOTCANDLE

FARADAY

public static final Unit FARADAY

FERMI

public static final Unit FERMI

FOOTLAMBERT

public static final Unit FOOTLAMBERT

US_FLUID_OUNCE

public static final Unit US_FLUID_OUNCE

UK_FLUID_OUNCE

public static final Unit UK_FLUID_OUNCE

FOOT

public static final Unit FOOT

SURVEY_FOOT

public static final Unit SURVEY_FOOT

GRAM

public static final Unit GRAM

STANDARD_GRAVITY

public static final Unit STANDARD_GRAVITY

CANADIAN_GALLON

public static final Unit CANADIAN_GALLON

UK_GALLON

public static final Unit UK_GALLON

US_GALLON

public static final Unit US_GALLON

GRAM_FORCE

public static final Unit GRAM_FORCE

US_GILL

public static final Unit US_GILL

GRADE

public static final Unit GRADE

GRAIN

public static final Unit GRAIN

GRAY

public static final Unit GRAY

HENRY

public static final Unit HENRY

HOUR

public static final Unit HOUR

HECTARE

public static final Unit HECTARE

HORSEPOWER

public static final Unit HORSEPOWER

HERTZ

public static final Unit HERTZ

INCH

public static final Unit INCH

INCHES_MERCURY_ZERO_C

public static final Unit INCHES_MERCURY_ZERO_C

INCHES_MERCURY_60DEG_F

public static final Unit INCHES_MERCURY_60DEG_F

JOULE

public static final Unit JOULE

KELVIN

public static final Unit KELVIN

KILOGRAM

public static final Unit KILOGRAM

KILOPOUND_FORCE

public static final Unit KILOPOUND_FORCE

NAUTICAL_MPH

public static final Unit NAUTICAL_MPH

KILOMETERS_PER_H

public static final Unit KILOMETERS_PER_H

LITER

public static final Unit LITER

LAMBERT

public static final Unit LAMBERT

POUND_FORCE

public static final Unit POUND_FORCE

POUND_FORCE_ALT

public static final Unit POUND_FORCE_ALT

POUND

public static final Unit POUND

TROY_POUND

public static final Unit TROY_POUND

LUMEN

public static final Unit LUMEN

LUX

public static final Unit LUX

LIGHT_YEAR

public static final Unit LIGHT_YEAR

METER

public static final Unit METER

MHO

public static final Unit MHO

MILE

public static final Unit MILE

US_MILE

public static final Unit US_MILE

MIL

public static final Unit MIL

MINUTE

public static final Unit MINUTE

METERS_MERCURY_ZERO_C

public static final Unit METERS_MERCURY_ZERO_C

MOLE

public static final Unit MOLE

MILES_PER_GALLON

public static final Unit MILES_PER_GALLON

MILES_PER_HOUR

public static final Unit MILES_PER_HOUR

NEWTON

public static final Unit NEWTON

NIBBLE

public static final Unit NIBBLE

NAUTICAL_MILE

public static final Unit NAUTICAL_MILE

OHM

public static final Unit OHM

OUNCE

public static final Unit OUNCE

TROY_OUNCE

public static final Unit TROY_OUNCE

POISE

public static final Unit POISE

PASCAL

public static final Unit PASCAL

PARSEC

public static final Unit PARSEC

POUNDAL

public static final Unit POUNDAL

PECK

public static final Unit PECK

PHOT

public static final Unit PHOT

PSI

public static final Unit PSI

PINT

public static final Unit PINT

PINT_DRY

public static final Unit PINT_DRY

QUART

public static final Unit QUART

QUART_DRY

public static final Unit QUART_DRY

RADIAN

public static final Unit RADIAN

ROENTGEN

public static final Unit ROENTGEN

RAD

public static final Unit RAD

RADIAN_ALT

public static final Unit RADIAN_ALT

ROD

public static final Unit ROD

REM

public static final Unit REM

REVOLUTION

public static final Unit REVOLUTION

RPM

public static final Unit RPM

SECOND

public static final Unit SECOND

SIEMENS

public static final Unit SIEMENS

STILB

public static final Unit STILB

SLUG

public static final Unit SLUG

STERADIAN

public static final Unit STERADIAN

STERE

public static final Unit STERE

STOKES

public static final Unit STOKES

SIEVERT

public static final Unit SIEVERT

TESLA

public static final Unit TESLA

TABLESPOON

public static final Unit TABLESPOON

EEC_THERM

public static final Unit EEC_THERM

SHORT_TON_US

public static final Unit SHORT_TON_US

METRIC_TON

public static final Unit METRIC_TON

LONG_TON_UK

public static final Unit LONG_TON_UK

TORR

public static final Unit TORR

TEASPOON

public static final Unit TEASPOON

MICRON

public static final Unit MICRON

VOLT

public static final Unit VOLT

WATT

public static final Unit WATT

WEBER

public static final Unit WEBER

WEEK

public static final Unit WEEK

YARD

public static final Unit YARD

YEAR

public static final Unit YEAR

UNITLESS_SYMBOL

public static final String UNITLESS_SYMBOL
See Also:
Constant Field Values

AMPERE_SYMBOL

public static final String AMPERE_SYMBOL
See Also:
Constant Field Values

ARE_SYMBOL

public static final String ARE_SYMBOL
See Also:
Constant Field Values

ACRE_SYMBOL

public static final String ACRE_SYMBOL
See Also:
Constant Field Values

ANGSTROM_SYMBOL

public static final String ANGSTROM_SYMBOL
See Also:
Constant Field Values

ARCMIN_SYMBOL

public static final String ARCMIN_SYMBOL
See Also:
Constant Field Values

ARCSEC_SYMBOL

public static final String ARCSEC_SYMBOL
See Also:
Constant Field Values

ATM_SYMBOL

public static final String ATM_SYMBOL
See Also:
Constant Field Values

ATOMIC_MASS_SYMBOL

public static final String ATOMIC_MASS_SYMBOL
See Also:
Constant Field Values

AU_SYMBOL

public static final String AU_SYMBOL
See Also:
Constant Field Values

BARN_SYMBOL

public static final String BARN_SYMBOL
See Also:
Constant Field Values

BAR_SYMBOL

public static final String BAR_SYMBOL
See Also:
Constant Field Values

BARREL_SYMBOL

public static final String BARREL_SYMBOL
See Also:
Constant Field Values

BECQUEREL_SYMBOL

public static final String BECQUEREL_SYMBOL
See Also:
Constant Field Values

BTU_SYMBOL

public static final String BTU_SYMBOL
See Also:
Constant Field Values

BIT_SYMBOL

public static final String BIT_SYMBOL
See Also:
Constant Field Values

BYTE_SYMBOL

public static final String BYTE_SYMBOL
See Also:
Constant Field Values

US_BUSHEL_SYMBOL

public static final String US_BUSHEL_SYMBOL
See Also:
Constant Field Values

SPEED_OF_LIGHT_SYMBOL

public static final String SPEED_OF_LIGHT_SYMBOL
See Also:
Constant Field Values

COULOMB_SYMBOL

public static final String COULOMB_SYMBOL
See Also:
Constant Field Values

CALORIE_SYMBOL

public static final String CALORIE_SYMBOL
See Also:
Constant Field Values

CANDELA_SYMBOL

public static final String CANDELA_SYMBOL
See Also:
Constant Field Values

CHAIN_SYMBOL

public static final String CHAIN_SYMBOL
See Also:
Constant Field Values

CURIE_SYMBOL

public static final String CURIE_SYMBOL
See Also:
Constant Field Values

CARAT_SYMBOL

public static final String CARAT_SYMBOL
See Also:
Constant Field Values

US_CUP_SYMBOL

public static final String US_CUP_SYMBOL
See Also:
Constant Field Values

DAY_SYMBOL

public static final String DAY_SYMBOL
See Also:
Constant Field Values

DEGREE_SYMBOL

public static final String DEGREE_SYMBOL
See Also:
Constant Field Values

DEGREE_CELSIUS_SYMBOL

public static final String DEGREE_CELSIUS_SYMBOL
See Also:
Constant Field Values

DEG_FAHRENHEIT_SYMBOL

public static final String DEG_FAHRENHEIT_SYMBOL
See Also:
Constant Field Values

DEGREE_RANKINE_SYMBOL

public static final String DEGREE_RANKINE_SYMBOL
See Also:
Constant Field Values

DYNE_SYMBOL

public static final String DYNE_SYMBOL
See Also:
Constant Field Values

ERG_SYMBOL

public static final String ERG_SYMBOL
See Also:
Constant Field Values

ELECTRON_VOLT_SYMBOL

public static final String ELECTRON_VOLT_SYMBOL
See Also:
Constant Field Values

FARAD_SYMBOL

public static final String FARAD_SYMBOL
See Also:
Constant Field Values

FATHOM_SYMBOL

public static final String FATHOM_SYMBOL
See Also:
Constant Field Values

BOARD_FOOT_SYMBOL

public static final String BOARD_FOOT_SYMBOL
See Also:
Constant Field Values

FOOTCANDLE_SYMBOL

public static final String FOOTCANDLE_SYMBOL
See Also:
Constant Field Values

FARADAY_SYMBOL

public static final String FARADAY_SYMBOL
See Also:
Constant Field Values

FERMI_SYMBOL

public static final String FERMI_SYMBOL
See Also:
Constant Field Values

FOOTLAMBERT_SYMBOL

public static final String FOOTLAMBERT_SYMBOL
See Also:
Constant Field Values

US_FLUID_OUNCE_SYMBOL

public static final String US_FLUID_OUNCE_SYMBOL
See Also:
Constant Field Values

UK_FLUID_OUNCE_SYMBOL

public static final String UK_FLUID_OUNCE_SYMBOL
See Also:
Constant Field Values

FOOT_SYMBOL

public static final String FOOT_SYMBOL
See Also:
Constant Field Values

SURVEY_FOOT_SYMBOL

public static final String SURVEY_FOOT_SYMBOL
See Also:
Constant Field Values

GRAM_SYMBOL

public static final String GRAM_SYMBOL
See Also:
Constant Field Values

STANDARD_GRAVITY_SYMBOL

public static final String STANDARD_GRAVITY_SYMBOL
See Also:
Constant Field Values

CANADIAN_GALLON_SYMBOL

public static final String CANADIAN_GALLON_SYMBOL
See Also:
Constant Field Values

UK_GALLON_SYMBOL

public static final String UK_GALLON_SYMBOL
See Also:
Constant Field Values

US_GALLON_SYMBOL

public static final String US_GALLON_SYMBOL
See Also:
Constant Field Values

GRAM_FORCE_SYMBOL

public static final String GRAM_FORCE_SYMBOL
See Also:
Constant Field Values

US_GILL_SYMBOL

public static final String US_GILL_SYMBOL
See Also:
Constant Field Values

GRADE_SYMBOL

public static final String GRADE_SYMBOL
See Also:
Constant Field Values

GRAIN_SYMBOL

public static final String GRAIN_SYMBOL
See Also:
Constant Field Values

GRAY_SYMBOL

public static final String GRAY_SYMBOL
See Also:
Constant Field Values

HENRY_SYMBOL

public static final String HENRY_SYMBOL
See Also:
Constant Field Values

HOUR_SYMBOL

public static final String HOUR_SYMBOL
See Also:
Constant Field Values

HECTARE_SYMBOL

public static final String HECTARE_SYMBOL
See Also:
Constant Field Values

HORSEPOWER_SYMBOL

public static final String HORSEPOWER_SYMBOL
See Also:
Constant Field Values

HERTZ_SYMBOL

public static final String HERTZ_SYMBOL
See Also:
Constant Field Values

INCH_SYMBOL

public static final String INCH_SYMBOL
See Also:
Constant Field Values

INCHES_MERCURY_ZERO_C_SYMBOL

public static final String INCHES_MERCURY_ZERO_C_SYMBOL
See Also:
Constant Field Values

INCHES_MERCURY_60DEG_F_SYMBOL

public static final String INCHES_MERCURY_60DEG_F_SYMBOL
See Also:
Constant Field Values

JOULE_SYMBOL

public static final String JOULE_SYMBOL
See Also:
Constant Field Values

KELVIN_SYMBOL

public static final String KELVIN_SYMBOL
See Also:
Constant Field Values

KILOGRAM_SYMBOL

public static final String KILOGRAM_SYMBOL
See Also:
Constant Field Values

KILOPOUND_FORCE_SYMBOL

public static final String KILOPOUND_FORCE_SYMBOL
See Also:
Constant Field Values

NAUTICAL_MPH_SYMBOL

public static final String NAUTICAL_MPH_SYMBOL
See Also:
Constant Field Values

KILOMETERS_PER_H_SYMBOL

public static final String KILOMETERS_PER_H_SYMBOL
See Also:
Constant Field Values

LITER_SYMBOL

public static final String LITER_SYMBOL
See Also:
Constant Field Values

LAMBERT_SYMBOL

public static final String LAMBERT_SYMBOL
See Also:
Constant Field Values

POUND_FORCE_SYMBOL

public static final String POUND_FORCE_SYMBOL
See Also:
Constant Field Values

POUND_FORCE_ALT_SYMBOL

public static final String POUND_FORCE_ALT_SYMBOL
See Also:
Constant Field Values

POUND_SYMBOL

public static final String POUND_SYMBOL
See Also:
Constant Field Values

TROY_POUND_SYMBOL

public static final String TROY_POUND_SYMBOL
See Also:
Constant Field Values

LUMEN_SYMBOL

public static final String LUMEN_SYMBOL
See Also:
Constant Field Values

LUX_SYMBOL

public static final String LUX_SYMBOL
See Also:
Constant Field Values

LIGHT_YEAR_SYMBOL

public static final String LIGHT_YEAR_SYMBOL
See Also:
Constant Field Values

METER_SYMBOL

public static final String METER_SYMBOL
See Also:
Constant Field Values

MHO_SYMBOL

public static final String MHO_SYMBOL
See Also:
Constant Field Values

MILE_SYMBOL

public static final String MILE_SYMBOL
See Also:
Constant Field Values

US_MILE_SYMBOL

public static final String US_MILE_SYMBOL
See Also:
Constant Field Values

MIL_SYMBOL

public static final String MIL_SYMBOL
See Also:
Constant Field Values

MINUTE_SYMBOL

public static final String MINUTE_SYMBOL
See Also:
Constant Field Values

METERS_MERCURY_ZERO_C_SYMBOL

public static final String METERS_MERCURY_ZERO_C_SYMBOL
See Also:
Constant Field Values

MOLE_SYMBOL

public static final String MOLE_SYMBOL
See Also:
Constant Field Values

MILES_PER_GALLON_SYMBOL

public static final String MILES_PER_GALLON_SYMBOL
See Also:
Constant Field Values

MILES_PER_HOUR_SYMBOL

public static final String MILES_PER_HOUR_SYMBOL
See Also:
Constant Field Values

NEWTON_SYMBOL

public static final String NEWTON_SYMBOL
See Also:
Constant Field Values

NAUTICAL_MILE_SYMBOL

public static final String NAUTICAL_MILE_SYMBOL
See Also:
Constant Field Values

NIBBLE_SYMBOL

public static final String NIBBLE_SYMBOL
See Also:
Constant Field Values

OHM_SYMBOL

public static final String OHM_SYMBOL
See Also:
Constant Field Values

OUNCE_SYMBOL

public static final String OUNCE_SYMBOL
See Also:
Constant Field Values

TROY_OUNCE_SYMBOL

public static final String TROY_OUNCE_SYMBOL
See Also:
Constant Field Values

POISE_SYMBOL

public static final String POISE_SYMBOL
See Also:
Constant Field Values

PASCAL_SYMBOL

public static final String PASCAL_SYMBOL
See Also:
Constant Field Values

PARSEC_SYMBOL

public static final String PARSEC_SYMBOL
See Also:
Constant Field Values

POUNDAL_SYMBOL

public static final String POUNDAL_SYMBOL
See Also:
Constant Field Values

PECK_SYMBOL

public static final String PECK_SYMBOL
See Also:
Constant Field Values

PHOT_SYMBOL

public static final String PHOT_SYMBOL
See Also:
Constant Field Values

PSI_SYMBOL

public static final String PSI_SYMBOL
See Also:
Constant Field Values

PINT_SYMBOL

public static final String PINT_SYMBOL
See Also:
Constant Field Values

PINT_DRY_SYMBOL

public static final String PINT_DRY_SYMBOL
See Also:
Constant Field Values

QUART_SYMBOL

public static final String QUART_SYMBOL
See Also:
Constant Field Values

QUART_DRY_SYMBOL

public static final String QUART_DRY_SYMBOL
See Also:
Constant Field Values

RADIAN_SYMBOL

public static final String RADIAN_SYMBOL
See Also:
Constant Field Values

ROENTGEN_SYMBOL

public static final String ROENTGEN_SYMBOL
See Also:
Constant Field Values

RAD_SYMBOL

public static final String RAD_SYMBOL
See Also:
Constant Field Values

RADIAN_ALT_SYMBOL

public static final String RADIAN_ALT_SYMBOL
See Also:
Constant Field Values

ROD_SYMBOL

public static final String ROD_SYMBOL
See Also:
Constant Field Values

REM_SYMBOL

public static final String REM_SYMBOL
See Also:
Constant Field Values

REVOLUTION_SYMBOL

public static final String REVOLUTION_SYMBOL
See Also:
Constant Field Values

RPM_SYMBOL

public static final String RPM_SYMBOL
See Also:
Constant Field Values

SECOND_SYMBOL

public static final String SECOND_SYMBOL
See Also:
Constant Field Values

SIEMENS_SYMBOL

public static final String SIEMENS_SYMBOL
See Also:
Constant Field Values

STILB_SYMBOL

public static final String STILB_SYMBOL
See Also:
Constant Field Values

SLUG_SYMBOL

public static final String SLUG_SYMBOL
See Also:
Constant Field Values

STERADIAN_SYMBOL

public static final String STERADIAN_SYMBOL
See Also:
Constant Field Values

STERE_SYMBOL

public static final String STERE_SYMBOL
See Also:
Constant Field Values

STOKES_SYMBOL

public static final String STOKES_SYMBOL
See Also:
Constant Field Values

SIEVERT_SYMBOL

public static final String SIEVERT_SYMBOL
See Also:
Constant Field Values

TESLA_SYMBOL

public static final String TESLA_SYMBOL
See Also:
Constant Field Values

TABLESPOON_SYMBOL

public static final String TABLESPOON_SYMBOL
See Also:
Constant Field Values

EEC_THERM_SYMBOL

public static final String EEC_THERM_SYMBOL
See Also:
Constant Field Values

SHORT_TON_US_SYMBOL

public static final String SHORT_TON_US_SYMBOL
See Also:
Constant Field Values

METRIC_TON_SYMBOL

public static final String METRIC_TON_SYMBOL
See Also:
Constant Field Values

LONG_TON_UK_SYMBOL

public static final String LONG_TON_UK_SYMBOL
See Also:
Constant Field Values

TORR_SYMBOL

public static final String TORR_SYMBOL
See Also:
Constant Field Values

TEASPOON_SYMBOL

public static final String TEASPOON_SYMBOL
See Also:
Constant Field Values

MICRON_SYMBOL

public static final String MICRON_SYMBOL
See Also:
Constant Field Values

VOLT_SYMBOL

public static final String VOLT_SYMBOL
See Also:
Constant Field Values

WATT_SYMBOL

public static final String WATT_SYMBOL
See Also:
Constant Field Values

WEBER_SYMBOL

public static final String WEBER_SYMBOL
See Also:
Constant Field Values

WEEK_SYMBOL

public static final String WEEK_SYMBOL
See Also:
Constant Field Values

YARD_SYMBOL

public static final String YARD_SYMBOL
See Also:
Constant Field Values

YEAR_SYMBOL

public static final String YEAR_SYMBOL
See Also:
Constant Field Values
Constructor Detail

Unit

public Unit()


Supported API: false


Unit

public Unit(String valueString,
            int sigFigs,
            String unitString)
     throws WTNumberFormatException,
            UnitFormatException


Supported API: false

Parameters:
valueString -
sigFigs -
unitString -
Throws:
WTNumberFormatException
UnitFormatException

Unit

public Unit(String valueString,
            String unitString)
     throws WTNumberFormatException,
            UnitFormatException


Supported API: false

Parameters:
valueString -
unitString -
Throws:
WTNumberFormatException
UnitFormatException

Unit

public Unit(double valueDouble,
            int sigFigs,
            String unitString)
     throws UnitFormatException


Supported API: false

Parameters:
valueDouble -
sigFigs -
unitString -
Throws:
UnitFormatException

Unit

public Unit(double valueDouble,
            String unitString)
     throws UnitFormatException


Supported API: false

Parameters:
valueDouble -
unitString -
Throws:
UnitFormatException

Unit

private Unit(double valueDouble,
             int sigFigs,
             int A,
             int cd,
             int kg,
             int K,
             int m,
             int mol,
             int r,
             int s,
             int sr,
             int B)
Parameters:
valueDouble -
sigFigs -
A -
cd -
kg -
K -
m -
mol -
r -
s -
sr -
B -
Method Detail

writeExternal

public void writeExternal(ObjectOutput output)
                   throws IOException
Writes the non-transient fields of this class to an external source.

Supported API: false

Specified by:
writeExternal in interface Externalizable
Parameters:
output -
Throws:
IOException

readExternal

public void readExternal(ObjectInput input)
                  throws IOException,
                         ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Specified by:
readExternal in interface Externalizable
Parameters:
input -
Throws:
IOException
ClassNotFoundException

readVersion

protected boolean readVersion(Unit thisObject,
                              ObjectInput input,
                              long readSerialVersionUID,
                              boolean passThrough,
                              boolean superDone)
                       throws IOException,
                              ClassNotFoundException
Reads the non-transient fields of this class from an external source.

Supported API: false

Parameters:
thisObject -
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

readOldVersion

private boolean readOldVersion(ObjectInput input,
                               long readSerialVersionUID,
                               boolean passThrough,
                               boolean superDone)
                        throws IOException,
                               ClassNotFoundException
Reads the non-transient fields of this class from an external source, which is not the current version.

Parameters:
input -
readSerialVersionUID -
passThrough -
superDone -
Returns:
boolean
Throws:
IOException
ClassNotFoundException

getValue

public double getValue()
Gets the value of the attribute: value; The floating point value.

Supported API: false

Returns:
double

setValue

public void setValue(double a_Value)
              throws WTPropertyVetoException
Sets the value of the attribute: value; The floating point value.

Supported API: false

Parameters:
a_Value -
Throws:
WTPropertyVetoException

getSigFigs

public int getSigFigs()
Gets the value of the attribute: sigFigs; The number of digits within the value that can be considered significant.

Supported API: false

Returns:
int

setSigFigs

public void setSigFigs(int a_SigFigs)
                throws WTPropertyVetoException
Sets the value of the attribute: sigFigs; The number of digits within the value that can be considered significant.

Supported API: false

Parameters:
a_SigFigs -
Throws:
WTPropertyVetoException

getUnits

public String getUnits()
Gets the value of the attribute: units; A derived attribute that generates String based accessors to the units.

Supported API: false

Returns:
String

setUnits

protected void setUnits(String a_Units)
                 throws UnitFormatException,
                        WTPropertyVetoException
Sets the value of the attribute: units; A derived attribute that generates String based accessors to the units.

Supported API: false

Parameters:
a_Units -
Throws:
UnitFormatException
WTPropertyVetoException

scale

public void scale(double scale)
Scales this Unit by the specified value.

Supported API: false

Parameters:
scale - the value that this Unit is scaled by.

multiply

public void multiply(Unit unitB,
                     int power)
Multiplies this Unit by the specified Unit raised to the specified power.

Supported API: false

Parameters:
unitB - the Unit that this Unit is multiplied by.
power - the power that the specified Unit is raised to.

multiply

public void multiply(Unit unitB)
Multiplies this Unit by the specified Unit.

Supported API: false

Parameters:
unitB - the Unit that this Unit is multiplied by.

divide

public void divide(Unit unitB)
Divides this Unit by the specified Unit.

Supported API: false

Parameters:
unitB - the Unit that this Unit is divided by.

pow

public void pow(int power)
Raises this Unit to the specified power.

Supported API: false

Parameters:
power - the power that this Unit is raised to.

add

public void add(Unit unitB)
         throws IncompatibleUnitsException
Adds the specified Unit to this Unit.

Supported API: false

Parameters:
unitB - the Unit that is added to this Unit.
Throws:
IncompatibleUnitsException - if the units of the specified Unit are not compatible with those of this Unit.

subtract

public void subtract(Unit unitB)
              throws IncompatibleUnitsException
Subtracts the specified Unit from this Unit.

Supported API: false

Parameters:
unitB - the Unit that is subtracted from this Unit.
Throws:
IncompatibleUnitsException - if the units of the specified Unit are not compatible with those of this Unit.

convert

public double convert(String unitString)
               throws IncompatibleUnitsException,
                      UnitFormatException
Returns a double representing the value of this Unit when converted to the units represented by the specified units string.

Supported API: false

Parameters:
unitString - the unit string that represents the units that this Unit will be converted to.
Returns:
a double representing the value of this Unit when converted to the units represented by the specified units string.
Throws:
IncompatibleUnitsException - if the units represented by the specified units string are not compatible with those of this Unit.
UnitFormatException - if the specified units string does not contain parsable units.

convertToString

public String convertToString(String unitString,
                              int displayDigits)
                       throws IncompatibleUnitsException,
                              UnitFormatException
Returns a string representing the value of this Unit when converted to the units represented by the specified units string, with the specified number of digits. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be included in the return value will be MAX_SIG_FIGS. If possible, the string is returned in floating point format. Otherwise, the string is returned in exponential format.

Supported API: false

Parameters:
unitString - the unit string that represents the units that this Unit will be converted to.
displayDigits - the number of digits to include in the return value.
Returns:
a string representing the value of this Unit when converted to the units represented by the specified units string, with the specified number of digits.
Throws:
IncompatibleUnitsException - if the units represented by the specified units string are not compatible with those of this Unit.
UnitFormatException - if the specified units string does not contain parsable units.

factor

public Unit factor(String unitString)
            throws UnitFormatException
Returns a Unit representing the result of factoring this Unit by the units represented by the specified units string.

Supported API: false

Parameters:
unitString - the unit string that represents the units that this Unit will be factored by.
Returns:
a Unit representing the result of factoring this Unit by the units represented by the specified units string.
Throws:
UnitFormatException - if the specified units string does not contain parsable units.

compatible

public boolean compatible(Unit unitB)
Returns true if the units of the specified Unit are compatible with those of this Unit.

Supported API: false

Parameters:
unitB - the Unit whose units will be compared with those of this Unit.
Returns:
a boolean representing whether or not the units of the specified Unit are compatible with those of this Unit.

compatible

public boolean compatible(String unitString)
                   throws UnitFormatException
Returns true if the units represented by the specified units string are compatible with those of this Unit.

Supported API: false

Parameters:
unitString - the unit string that represents the units that will be compared with those of this Unit.
Returns:
a boolean representing whether or not the units represented by the specified units string are compatible with those of this Unit.
Throws:
UnitFormatException - if the specified units string does not contain parsable units.

containsUnknownUnits

public boolean containsUnknownUnits()
Returns true if this Unit contains any unknown units. Unknown units are any combination of symbols that are not found in the Unit internal conversion tables, or any combination of symbols involving floating point exponents.

Supported API: false

Returns:
a boolean representing whether or not this Unit contains any unknown units

toString

public String toString()
Return a string equivalent to getValueString() + " " + getUnits().

Supported API: false

Returns:
a string equivalent to getValueString() + " " + getUnits().
See Also:
getValueString(), getUnits()

toString

public String toString(Hashtable symbolMap,
                       int displayDigits)
                throws UnitFormatException,
                       IncompatibleUnitsException
Return a string equivalent to getValueString(symbolMap,displayDigits) + " " + getUnits(symbolMap,displayDigits).

Supported API: false

Parameters:
symbolMap -
displayDigits -
Returns:
a string equivalent to getValueString(symbolMap,displayDigits) + " " + getUnits(symbolMap,displayDigits).
Throws:
IncompatibleUnitsException - if one or more of the units represented by the specified symbol map is not compatible with the corresponding internal symbol.
UnitFormatException - if one or more of the units strings within the specified symbol map does not contain parsable units.
See Also:
getValueString(Hashtable,int), getUnits(Hashtable)

getValueString

public String getValueString()
Returns the value of this Unit as a string with MAX_SIG_FIGS digits. If possible, the string is returned in floating point format. Otherwise, the string is returned in exponential format.

Supported API: false

Returns:
the value of this Unit as a string with MAX_SIG_FIGS digits.

getValueString

public String getValueString(Hashtable symbolMap,
                             int displayDigits)
                      throws UnitFormatException,
                             IncompatibleUnitsException
Returns a string representation of the value of this Unit with the specified number of digits, after conversion to units represented by the base symbols corresponding to the specified symbol map. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be included in the return value will be MAX_SIG_FIGS. If a mapping for any internal symbol does not exist in the specified symbol map, the internal base symbols are used. If possible, the string is returned in floating point format. Otherwise, the string is returned in exponential format.

Supported API: false

Parameters:
symbolMap - a hashtable representing the base symbols that should used in the construction of the return string. The hash table should store replacement symbol strings, keyed by internal symbol strings from BASE_SYMBOLS.
Returns:
a string representation of the units of this Unit, composed of the symbols corresponding to the specified symbol map.
Throws:
IncompatibleUnitsException - if one or more of the units represented by the specified symbol map is not compatible with the corresponding internal symbol.
UnitFormatException - if one or more of the units strings within the specified symbol map does not contain parsable units.

getUnits

public String getUnits(Hashtable symbolMap)
                throws UnitFormatException,
                       IncompatibleUnitsException
Returns a string representation of the units of this Unit, composed of the base symbols corresponding to the specified symbol map. If a mapping for any internal symbol does not exist in the specified symbol map, the internal base symbols are used.

Supported API: false

Parameters:
symbolMap - a hashtable representing the base symbols that should used in the construction of the return string. The hash table should store replacement symbol strings, keyed by internal symbol strings from BASE_SYMBOLS.
Returns:
a string representation of the units of this Unit, composed of the symbols corresponding to the measurement system represented by the specified measurement system name.
Throws:
IncompatibleUnitsException - if one or more of the units represented by the specified symbol map is not compatible with the corresponding internal symbol.
UnitFormatException - if one or more of the units strings within the specified symbol map does not contain parsable units.

getMinimumRoundingEquivalent

public Unit getMinimumRoundingEquivalent(int roundingDigits)
Returns a Unit with the minimum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be used in calculating the return value will be MAX_SIG_FIGS.

Supported API: false

Parameters:
roundingDigits - the number of digits that will be considered when constructing the rounding equivalent.
Returns:
a Unit with the minimum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits.

getMinimumRoundingEquivalent

public Unit getMinimumRoundingEquivalent()
Returns a Unit with the minimum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.

Supported API: false

Returns:
a Unit with the minimum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.

getMaximumRoundingEquivalent

public Unit getMaximumRoundingEquivalent(int roundingDigits)
Returns a Unit with the maximum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be used in calculating the return value will be MAX_SIG_FIGS.

Supported API: false

Parameters:
roundingDigits - the number of digits that will be considered when constructing the rounding equivalent.
Returns:
a Unit with the maximum possible value that, when rounded to the specified number of digits, is equal to this Unit rounded to the same number of digits.

getMaximumRoundingEquivalent

public Unit getMaximumRoundingEquivalent()
Returns a Unit with the maximum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.

Supported API: false

Returns:
a Unit with the maximum possible value that, when rounded to a number of digits equal to the number of significant figures in the Unit, is equal to this Unit rounded to the same number of digits.

equals

public boolean equals(Object obj)
Returns true if the specified object is an instance of Unit that has units that are compatible with those of this Unit, that has the same number of significant figues as this Unit, and that has a value equal to that of this unit when rounded to significant figures.

Supported API: false

Parameters:
obj - the object that will be tested for equality with this Unit.
Returns:
a boolean representing whether or not the specified object is an instance of Unit that has units that are compatible with those of this Unit, that has the same number of significant figues as this Unit, and that has a value equal to that of this unit when rounded to significant figures.

clone

public Object clone()
Returns a clone of this Unit.

Supported API: false

Returns:
a clone of this Unit.

lookupSymbol

public static Unit lookupSymbol(String symbol)
Returns a Unit corresponding to the specified symbol string.

Supported API: false

Parameters:
symbol - the symbol representing the Unit to be returned.
Returns:
a Unit corresponding to the specified symbol string.

toString

private String toString(String[] systemSymbols,
                        int displayDigits)
                 throws UnitFormatException,
                        IncompatibleUnitsException
Return a string equivalent to getValueString(systemSymbols,displayDigits) + " " + getUnits(systemSymbols,displayDigits).

Parameters:
systemSymbols -
displayDigits -
Returns:
a string equivalent to getValueString(systemSymbols,displayDigits) + " " + getUnits(systemSymbols,displayDigits).
Throws:
UnitFormatException
IncompatibleUnitsException
See Also:
getValueString(String[],int), #getUnits(String[],int)

getValueString

private String getValueString(String[] systemSymbols,
                              int displayDigits)
                       throws UnitFormatException,
                              IncompatibleUnitsException
Returns a string representation of the value of this Unit with the specified number of digits, after conversion to units represented by the specified base symbols. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be included in the return value will be MAX_SIG_FIGS. If possible, the string is returned in floating point format. Otherwise, the string is returned in exponential format.

Parameters:
systemSymbols - a string array representing the base symbols that should used in the construction of the return string.
displayDigits - the number of digits to include in the return value.
Returns:
a string representation of the value of this Unit with the specified number of digits, after conversion to units represented by the specified base symbols.
Throws:
UnitFormatException
IncompatibleUnitsException

getUnits

private String getUnits(String[] systemSymbols)
                 throws UnitFormatException,
                        IncompatibleUnitsException
Returns a string representation of the units of this Unit, composed of the specified base symbols.

Parameters:
systemSymbols - the base symbols that should be used in the construction of the return string.
Returns:
a string representation of the units of this Unit, composed of the specified base symbols.
Throws:
UnitFormatException
IncompatibleUnitsException

getKnownUnits

private String getKnownUnits(String[] systemSymbols)
Returns a units string composed of the specified symbols and representing the portion of the units of this Unit that are not unknown. (Unknown units are any combination of symbols that are not found in the Unit internal conversion tables, or any combination of symbols involving floating point exponents.)

Parameters:
systemSymbols - the symbols to be used in constructing the known units string.
Returns:
a units string composed of the specified symbols and representing the portion of the units of this Unit that are not unknown.

getSystemSymbols

private String[] getSystemSymbols(Hashtable symbolMap)
                           throws UnitFormatException
Returns the set of base symbols that corresponds to the specified symbol map. If a mapping for any internal symbol does not exist in the specified symbol map, the internal base symbols are used.

Parameters:
symbolMap - a hashtable representing the base symbols that should used in the construction of the return string array. The hash table should store replacement symbol strings, keyed by internal symbol strings from BASE_SYMBOLS.
Returns:
the set of base symbols that corresponds to the specified symbol map.
Throws:
UnitFormatException

loadTables

private void loadTables()
Loads the internal symbol table and prefix table that are used for unit conversions. Temporary implementation - will be loaded from file.


countSigFigs

private static int countSigFigs(String valueString)
Returns the number of significant figures that exist in the specified string representation of a floating point number.

Parameters:
valueString - the string that represents the floating point number.
Returns:
the number of significant figures that exist in the specified string representation of a floating point number.

doubleToString

private String doubleToString(double doubleValue,
                              int numDigits)
Returns a string representation of the specified double rounded to the specified number of digits. If possible, the string is returned in floating point format. Otherwise, the string is returned in exponential format.

Parameters:
doubleValue -
numDigits -
Returns:
String

parseUnit

private Unit parseUnit(char[] unitChars,
                       int startIndex,
                       int endIndex)
                throws UnitFormatException
Returns a Unit corresponding to the results of parsing the specified character array from the specified start index to the specified end index.

Parameters:
unitChars - the character array to be parsed.
startIndex - the initial index within the specified character array at which parsing should begin.
endIndex - the final index within the specified character array at which parsing should stop.
Returns:
a Unit corresponding to the results of parsing the specified character array from the specified start index to the specified end index.
Throws:
UnitFormatException

getCloseIndex

private int getCloseIndex(char[] unitChars,
                          int startIndex)
Returns the index of the first occurrance of the CLOSE_PARENTHESIS character in the specified character array, starting at the specified start index. Returns -1 if CLOSE_PARENTHESIS character is not found.

Parameters:
unitChars - the character array to be scanned.
startIndex - the initial index at which scanning will begin.
Returns:
the index of the first occurrance of the CLOSE_PARENTHESIS character in the specified character array, starting at the specified start index.

roundingEquivalent

private double roundingEquivalent(double doubleValue,
                                  int roundingDigits,
                                  int roundingDirection)
Returns the largest or smallest double that, when rounded to the specified number of digits, is equal to the specified double rounded to the same number of digits. If the specified rounding direction is -1, then the largest double is returned. If the specified rounding direction is 1, then the smallest double is returned. If the specified number of digits is less than 1 or greater than MAX_SIG_FIGS, then the number of digits that will be used in calculating the return value will be MAX_SIG_FIGS.

Parameters:
roundingDigits - the number of digits that will be considered when calculating the rounding equivalent.
roundingDirection - the rounding direction, up or down, that will be used when calculating the rounding equivalent.
Returns:
the largest or smallest double that, when rounded to the specified number of digits, is equal to the specified double rounded to the same number of digits.

hashCode

public int hashCode()