Package 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
@Immutable 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").- 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UnknownUnitcreate(String name)Factory method for constructing an unknown unit from a name.booleanequals(Object object)Indicates if this unit is semantically identical to an object.inthashCode()Returns the hash code of this instance.booleanisDimensionless()Indicates if this unit is dimensionless.-
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.
-
hashCode
public int hashCode()
Returns the hash code of this instance.- Overrides:
hashCodein classDerivedUnitImpl- 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:
isDimensionlessin interfaceBase- Specified by:
isDimensionlessin interfaceUnit- Overrides:
isDimensionlessin classBaseUnit- Returns:
falsealways.
-
-