org.deegree.cs.components
Interface IUnit

All Superinterfaces:
CRSResource, Object, TypedObjectNode
All Known Implementing Classes:
Unit, UnitRef

public interface IUnit
extends CRSResource

Interface describing a Unit

Version:
$Revision: $, $Date: $
Author:
Lyn Buesching, last edited by: $Author: lyn $

Method Summary
 boolean canConvert(IUnit other)
          Check if amount of the specified unit can be converted into amount of this unit.
 double convert(double value, IUnit targetUnit)
          Convert a value in this unit to the given unit if possible.
 IUnit getBaseType()
           
 double getScale()
           
 boolean isBaseType()
           
 double toBaseUnits(double value)
          Convert a value in this unit to the base unit, e.g. degree->radians
 
Methods inherited from interface org.deegree.cs.CRSResource
addAreaOfUse, addName, getAreaOfUse, getAreaOfUseBBox, getAreasOfUse, getCode, getCodeAndName, getCodes, getDescription, getDescriptions, getName, getNames, getOrignalCodeStrings, getVersion, getVersions, hasCode, hasId, hasIdOrName, setDefaultAreaOfUse, setDefaultDescription, setDefaultId, setDefaultName, setDefaultVersion
 
Methods inherited from interface org.deegree.commons.tom.Object
getId
 

Method Detail

canConvert

boolean canConvert(IUnit other)
Check if amount of the specified unit can be converted into amount of this unit.

Parameters:
other -
Returns:
true if this unit can be converted into the other unit

convert

double convert(double value,
               IUnit targetUnit)
Convert a value in this unit to the given unit if possible.

Parameters:
value - to be converted
targetUnit - to convert to
Returns:
the converted value or the same value if this unit equals given unit.
Throws:
IllegalArgumentException - if no conversion can be applied.

toBaseUnits

double toBaseUnits(double value)
Convert a value in this unit to the base unit, e.g. degree->radians

Parameters:
value - to be converted
Returns:
the converted value or the same value if this unit is a base unit.

getScale

double getScale()
Returns:
the scale to convert to the base unit.

getBaseType

IUnit getBaseType()
Returns:
the base unit.

isBaseType

boolean isBaseType()
Returns:
true if this is a base type


Copyright © 2011. All Rights Reserved.