com.sas.measures
Class Distance

com.sas.measures.Distance
All Implemented Interfaces:
com.sas.measures.MeasureInterface, com.sas.PublicClonable, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
Length

public class Distance

Distance provides an object which represents a linear measurement in one of several different units. The units are broken up into three types: BaseDistance.FIXED_UNITS, BaseDistance.FONT_UNITS and BaseDistance.DEVICE_UNITS. Currently only FIXED_UNITS and DEVICE_UNITS units are supported.

The units, grouped by type with full name followed by abbreviation, are as follows:

See Also:
Serialized Form

Field Summary
static java.lang.String RB_KEY
           
 
Fields inherited from class com.sas.measures.BaseDistance
DEVICE_UNITS, FIXED_UNITS, FONT_UNITS, unitIndex
 
Fields inherited from class com.sas.measures.Measure
DISPLAY_FORMAT_NOSPACE_BETWEEN_MAGNITUDE_AND_UNIT, DISPLAY_FORMAT_SPACE_BETWEEN_MAGNITUDE_AND_UNIT, displayFormat, locale, magnitude
 
Constructor Summary
Distance(double magnitude, java.lang.String unit)
          Constructs a Distance object from the specified magnitude and unit of measure.
Distance(java.lang.String text)
          Constructs a Distance object from a string consisting of a numeric value and unit of measure.
 
Method Summary
static AssociationListInterface makeUnitsAssociationList(int id)
          Returns a collection of equivalent different units with scaled magnitude values.
static StaticOrderedCollectionInterface makeUnitsList(int id)
          Returns a collection of the specified units.
 
Methods inherited from class com.sas.measures.BaseDistance
getMagnitude, getMagnitude, getUnit, getUnitName, getUnitType, initializeUnit, makeUnitsJavaList, makeUnitsMap, validateUnit
 
Methods inherited from class com.sas.measures.Measure
_init, clone, equals, equals, getMagnitude, hashCode, toString
 

Field Detail

RB_KEY

public static final java.lang.String RB_KEY
See Also:
Constant Field Values
Constructor Detail

Distance

public Distance(double magnitude,
                java.lang.String unit)
Constructs a Distance object from the specified magnitude and unit of measure.

Parameters:
magnitude - numeric value of the measurement
unit - unit of measure
Throws:
java.lang.IllegalArgumentException - if the unit is not a supported unit of measure

Distance

public Distance(java.lang.String text)
Constructs a Distance object from a string consisting of a numeric value and unit of measure.

Parameters:
text - a string consisting of a number, some whitespace, and a supported units token, such as "10 mm" or "2.5e3 nm"
text - string containing the magnitude and unit of measure
Throws:
java.lang.IllegalArgumentException - if the unit is not a supported unit of measure
Method Detail

makeUnitsAssociationList

public static AssociationListInterface makeUnitsAssociationList(int id)
Returns a collection of equivalent different units with scaled magnitude values. Possible values for id are: BaseDistance.FIXED_UNITS, BaseDistance.FONT_UNITS and BaseDistance.DEVICE_UNITS which can be combined in an OR relationship to specify all.

Parameters:
id - Specifies in which units the values should be returned.

makeUnitsList

public static StaticOrderedCollectionInterface makeUnitsList(int id)
Returns a collection of the specified units. Possible values for id are: BaseDistance.FIXED_UNITS, BaseDistance.FONT_UNITS and BaseDistance.DEVICE_UNITS which can be combined in an OR relationship to specify all.

Parameters:
id - Specifies which units should be in the collection.



Copyright © 2009 SAS Institute Inc. All Rights Reserved.