| org.cougaar.planning.ldm.measure.Measure
All known Subclasses: org.cougaar.planning.ldm.measure.AbstractMeasure,
Measure | public interface Measure extends Comparable,Serializable(Code) | | Base interface for all Measure classes.
All concrete subclasses of AbstractMeasure are required to
implement the method:
public static AbstractMeasure newMeasure(String s, int unit);
Other AbstractMeasure-level constructors may be defined, depending
on each the primative-types that each concrete class can handle.
For instance, Distance is based on a double value, so in addition to
the above, Distance.newMeasure(double d, int unit) will be defined.
The allowed values of the unit specifier depends on (and is defined
in) each Measure type. Example: Distance.FEET is a static final int
with the correct value for use in constructing Distances in Feet.
Each Measure class will also define a getValue(int unit) method
returning whatever primitive type it is based on (usually double).
All Measure classes are equals() comparable (exact internal value
equality), define toString() (the value in a standard unit and a unit
abbreviation, e.g. "4.5m"), and define hashCode() (for completeness).
See Also: AbstractMeasure See Also: for base implementation class of all measures. |
getCommonUnit | int getCommonUnit()(Code) | | a commonly-used unit used by this measure. NOTE that thisis only a convenience and should not be depended on for computationaluse, since the notion of a common unit is extremely dependent oncontext. |
getMaxUnit | int getMaxUnit()(Code) | | the value of the highest-valued unit known by this measure.There is no implied relationship between "highest valued" unit and "size" of that unit. |
getNativeUnit | int getNativeUnit()(Code) | | The Measure holds the value in a native unit - what is it?
the native unit - what the measure uses as the internal unit |
getNativeValue | double getNativeValue()(Code) | | |
getUnitName | String getUnitName(int unit)(Code) | | The result is undefined if the unit is not valid for this measure class.
Parameters: unit - to get name of the name of the unit specified. |
getValue | double getValue(int unit)(Code) | | the value of the measure in terms of the specified units. Parameters: unit - must be in the range from 0 to getMaxUnit. |
|
|