ucar.units
Class UnknownUnit
java.lang.Object
ucar.units.UnitImpl
ucar.units.DerivedUnitImpl
ucar.units.BaseUnit
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
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.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 interface ucar.units.Unit |
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo |
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.