org.deegree.cs.refs.components
Class UnitRef

java.lang.Object
  extended by org.deegree.commons.tom.Reference<T>
      extended by org.deegree.cs.refs.CRSResourceRef<IUnit>
          extended by org.deegree.cs.refs.components.UnitRef
All Implemented Interfaces:
Serializable, Object, TypedObjectNode, IUnit, CRSResource

public class UnitRef
extends CRSResourceRef<IUnit>
implements Serializable, IUnit

CRSResourceRef to a IUnit

Version:
$Revision: $, $Date: $
Author:
Lyn Buesching, last edited by: $Author: lyn $
See Also:
Serialized Form

Constructor Summary
UnitRef(ReferenceResolver resolver, String uri, String baseURL)
          Creates a reference to a IUNit
 
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.
 boolean equals(Object obj)
           
 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 class org.deegree.cs.refs.CRSResourceRef
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 class org.deegree.commons.tom.Reference
getId, getReferencedObject, getURI, isLocal, isResolved, resolve
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
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
 

Constructor Detail

UnitRef

public UnitRef(ReferenceResolver resolver,
               String uri,
               String baseURL)
Creates a reference to a IUNit

Parameters:
resolver - used for resolving the reference, must not be null
uri - the object's uri, must not be null
baseURL - base URL for resolving the uri, may be null (no resolving of relative URLs)
Method Detail

canConvert

public boolean canConvert(IUnit other)
Description copied from interface: IUnit
Check if amount of the specified unit can be converted into amount of this unit.

Specified by:
canConvert in interface IUnit
Returns:
true if this unit can be converted into the other unit

convert

public double convert(double value,
                      IUnit targetUnit)
Description copied from interface: IUnit
Convert a value in this unit to the given unit if possible.

Specified by:
convert in interface IUnit
Parameters:
value - to be converted
targetUnit - to convert to
Returns:
the converted value or the same value if this unit equals given unit.

toBaseUnits

public double toBaseUnits(double value)
Description copied from interface: IUnit
Convert a value in this unit to the base unit, e.g. degree->radians

Specified by:
toBaseUnits in interface IUnit
Parameters:
value - to be converted
Returns:
the converted value or the same value if this unit is a base unit.

getScale

public double getScale()
Specified by:
getScale in interface IUnit
Returns:
the scale to convert to the base unit.

isBaseType

public boolean isBaseType()
Specified by:
isBaseType in interface IUnit
Returns:
true if this is a base type

getBaseType

public IUnit getBaseType()
Specified by:
getBaseType in interface IUnit
Returns:
the base unit.

equals

public boolean equals(Object obj)
Overrides:
equals in class CRSResourceRef<IUnit>


Copyright © 2011. All Rights Reserved.