com.isti.util
Class MeasurementUnits

java.lang.Object
  extended bycom.isti.util.MeasurementUnits
All Implemented Interfaces:
MeasurementUnitsInformation

public class MeasurementUnits
extends java.lang.Object
implements MeasurementUnitsInformation

Class MeasurementUnits contains various methods and // constants for measurement units.


Field Summary
static java.lang.String DEFAULT_DISPLAY_NAME
          The display name for the default measurement units.
static java.lang.String METRIC_DISPLAY_NAME
          The display name for the metric measurement units.
static java.lang.String US_DISPLAY_NAME
          The display name for the U.S.
 
Fields inherited from interface com.isti.util.MeasurementUnitsInformation
DEFAULT_MEASUREMENT_UNITS, FEET, FEET_TO_METER, KILOM, KM_TO_MILE, METER, METER_TO_FEET, METER_TO_KM, METER_TO_MILE, MILE_TO_KM, MILE_TO_METER, MILES
 
Constructor Summary
MeasurementUnits()
           
 
Method Summary
static CfgPropValidator getCfgPropValidator()
          Gets the configuration property validator.
static int getIntegerValue(double d, int mu)
          Converts the value to the current units.
 int getMeasurementUnits()
          Gets the measurement units.
static int getMeasurementUnits(int mu)
          Gets the measurement units or the measurement units for the default locale.
static int getMeasurementUnits(int mu, java.util.Locale localeObj)
          Gets the measurement units.
static java.lang.String getMeasurementUnitsString(boolean pluralFlag, int mu)
          Gets the measurement units string for the specified specified units.
static java.lang.String getMeasurementUnitsString(double d, int mu)
          Gets the measurement units string for the specified specified units.
static java.lang.String getMeasurementUnitsString(int dVal, int mu)
          Gets the measurement units string for the specified specified units.
 double getValue(double d)
          Converts the value to the current units.
static double getValue(double d, int mu)
          Converts the value to the specified units.
 java.lang.String getValueString(double d)
          Gets the value string in the current units.
static java.lang.String getValueString(double d, int mu)
          Gets the value string in the specified units.
static java.lang.String getValueString(int dVal, int mu)
          Gets the value string in the specified units.
 boolean isMetric()
          Determines if the current units is metric.
static boolean isMetric(int mu)
          Determines if the specified units is metric.
static int parseMeasurementUnits(java.lang.String dataStr)
          Parses the data string for measurement units.
 void setMeasurementUnits(int mu)
          Sets the measurement units.
 void setMeasurementUnits(java.lang.String dataStr)
          Sets the measurement units.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_DISPLAY_NAME

public static java.lang.String DEFAULT_DISPLAY_NAME
The display name for the default measurement units.


METRIC_DISPLAY_NAME

public static java.lang.String METRIC_DISPLAY_NAME
The display name for the metric measurement units.


US_DISPLAY_NAME

public static java.lang.String US_DISPLAY_NAME
The display name for the U.S. measurement units.

Constructor Detail

MeasurementUnits

public MeasurementUnits()
Method Detail

getIntegerValue

public static int getIntegerValue(double d,
                                  int mu)
Converts the value to the current units.

Parameters:
d - the value in meters.
mu - the measurement units.
Returns:
the converted value.

getMeasurementUnits

public int getMeasurementUnits()
Gets the measurement units.

Specified by:
getMeasurementUnits in interface MeasurementUnitsInformation
Returns:
the measurement units.

getMeasurementUnits

public static int getMeasurementUnits(int mu)
Gets the measurement units or the measurement units for the default locale.

Parameters:
mu - the measurement units.
Returns:
the measurement units.

getMeasurementUnits

public static int getMeasurementUnits(int mu,
                                      java.util.Locale localeObj)
Gets the measurement units.

Parameters:
mu - the measurement units.
localeObj - the locale object.
Returns:
the measurement units.

getMeasurementUnitsString

public static java.lang.String getMeasurementUnitsString(boolean pluralFlag,
                                                         int mu)
Gets the measurement units string for the specified specified units.

Parameters:
pluralFlag - true to use the plural text.
mu - the measurement units.
Returns:
the measurement units string.

getMeasurementUnitsString

public static java.lang.String getMeasurementUnitsString(double d,
                                                         int mu)
Gets the measurement units string for the specified specified units.

Parameters:
d - the value in meters.
mu - the measurement units.
Returns:
the measurement units string.

getMeasurementUnitsString

public static java.lang.String getMeasurementUnitsString(int dVal,
                                                         int mu)
Gets the measurement units string for the specified specified units.

Parameters:
dVal - the value in meters.
mu - the measurement units.
Returns:
the measurement units string.

getCfgPropValidator

public static CfgPropValidator getCfgPropValidator()
Gets the configuration property validator.

Returns:
the 'CfgPropValidator'.

getValue

public double getValue(double d)
Converts the value to the current units.

Parameters:
d - the value in meters.
Returns:
the converted value.

getValue

public static double getValue(double d,
                              int mu)
Converts the value to the specified units.

Parameters:
d - the value in meters.
mu - the measurement units.
Returns:
the converted value.

parseMeasurementUnits

public static int parseMeasurementUnits(java.lang.String dataStr)
Parses the data string for measurement units.

Parameters:
dataStr - the measurement units data string.
Returns:
the measurement units.

getValueString

public java.lang.String getValueString(double d)
Gets the value string in the current units.

Parameters:
d - the value in meters.
Returns:
the value string.

getValueString

public static java.lang.String getValueString(double d,
                                              int mu)
Gets the value string in the specified units.

Parameters:
d - the value in meters.
mu - the measurement units.
Returns:
the value string.

getValueString

public static java.lang.String getValueString(int dVal,
                                              int mu)
Gets the value string in the specified units.

Parameters:
dVal - the value in meters.
mu - the measurement units.
Returns:
the value string.

isMetric

public boolean isMetric()
Determines if the current units is metric.

Returns:
true if the units is metric, false otherwise.

isMetric

public static boolean isMetric(int mu)
Determines if the specified units is metric.

Parameters:
mu - the measurement units.
Returns:
true if the units is metric, false otherwise.

setMeasurementUnits

public void setMeasurementUnits(int mu)
Sets the measurement units.

Specified by:
setMeasurementUnits in interface MeasurementUnitsInformation
Parameters:
mu - the measurement units.

setMeasurementUnits

public void setMeasurementUnits(java.lang.String dataStr)
Sets the measurement units.

Parameters:
dataStr - the measurement units data string.