ucar.units
Class UnknownUnit

java.lang.Object
  extended by ucar.units.UnitImpl
      extended by ucar.units.DerivedUnitImpl
          extended by ucar.units.BaseUnit
              extended by ucar.units.UnknownUnit
All Implemented Interfaces:
Serializable, Base, DerivableUnit, DerivedUnit, Unit

public final class UnknownUnit
extends BaseUnit

Provides support for unknown base units. This can be used, for example, to accomodate an unknown unit (e.g. "foo"). Values in such a unit will only be convertible with units derived from "foo" (e.g. "20 foo").

Version:
$Id: UnknownUnit.java 64 2006-07-12 22:30:50Z edavis $
Author:
Steven R. Emmerson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ucar.units.UnitImpl
UnitImpl.MyConverter
 
Field Summary
 
Fields inherited from class ucar.units.DerivedUnitImpl
DIMENSIONLESS
 
Method Summary
static UnknownUnit create(String name)
          Factory method for constructing an unknown unit from a name.
 boolean equals(Object object)
          Indicates if this unit is semantically identical to an object.
 int hashCode()
          Returns the hash code of this instance.
 boolean isDimensionless()
          Indicates if this unit is dimensionless.
static void main(String[] args)
          Tests this class.
 
Methods inherited from class ucar.units.BaseUnit
getBaseQuantity, getID, getOrCreate, toString
 
Methods inherited from class ucar.units.DerivedUnitImpl
clone, fromDerivedUnit, fromDerivedUnit, fromDerivedUnit, fromDerivedUnit, getCanonicalString, getDerivedUnit, getDimension, getQuantityDimension, isCompatible, isReciprocalOf, myDivideBy, myDivideInto, myMultiplyBy, myRaiseTo, setDimension, toDerivedUnit, toDerivedUnit, toDerivedUnit, toDerivedUnit
 
Methods inherited from class ucar.units.UnitImpl
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface ucar.units.Unit
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo
 

Method Detail

create

public static UnknownUnit create(String name)
                          throws NameException
Factory method for constructing an unknown unit from a name.

Parameters:
name - The name of the unit.
Returns:
The unknown unit.
Throws:
NameException - name == null.

equals

public boolean equals(Object object)
Indicates if this unit is semantically identical to an object.

Specified by:
equals in interface Base
Specified by:
equals in interface Unit
Overrides:
equals in class DerivedUnitImpl
Parameters:
object - The object.
Returns:
true if and only if this instance is semantically identical to the object.

hashCode

public int hashCode()
Returns the hash code of this instance.

Overrides:
hashCode in class DerivedUnitImpl
Returns:
The hash code of this instance.

isDimensionless

public boolean isDimensionless()
Indicates if this unit is dimensionless. An unknown unit is never dimensionless.

Specified by:
isDimensionless in interface Base
Specified by:
isDimensionless in interface Unit
Overrides:
isDimensionless in class BaseUnit
Returns:
false always.

main

public static void main(String[] args)
                 throws Exception
Tests this class.

Throws:
Exception


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.