@Immutable public class BaseUnit extends DerivedUnitImpl implements Base
UnitImpl.MyConverter
DIMENSIONLESS
Modifier | Constructor and Description |
---|---|
protected |
BaseUnit(UnitName id,
BaseQuantity baseQuantity)
Constructs from identifiers and a base quantity.
|
Modifier and Type | Method and Description |
---|---|
BaseQuantity |
getBaseQuantity()
Returns the base quantity associated with this base unit.
|
java.lang.String |
getID()
Returns the identifier for this base unit.
|
static BaseUnit |
getOrCreate(UnitName id,
BaseQuantity baseQuantity)
Factory method for creating a new BaseUnit or obtaining a
previously-created one.
|
boolean |
isDimensionless()
Indicates if this base unit is dimensionless.
|
static void |
main(java.lang.String[] args)
Tests this class.
|
java.lang.String |
toString()
Returns the string representation of this base unit.
|
clone, equals, fromDerivedUnit, fromDerivedUnit, fromDerivedUnit, fromDerivedUnit, getCanonicalString, getDerivedUnit, getDimension, getQuantityDimension, hashCode, isCompatible, isReciprocalOf, myDivideBy, myDivideInto, myMultiplyBy, myRaiseTo, setDimension, toDerivedUnit, toDerivedUnit, toDerivedUnit, toDerivedUnit
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo
protected BaseUnit(UnitName id, BaseQuantity baseQuantity) throws NameException
id
- The identifiers for the base unit.
id.getSymbol()
shall not return
null
.baseQuantity
- The base quantity of the base unit.NameException
- id.getSymbol()
returned
null
.public static BaseUnit getOrCreate(UnitName id, BaseQuantity baseQuantity) throws NameException, UnitExistsException
id
- The identifier for the base unit.
id.getSymbol()
shall not return
null
.baseQuantity
- The base quantity of the base unit.NameException
- id.getSymbol()
returned
null
.UnitExistsException
- Attempt to incompatibly redefine an existing base unit.public final BaseQuantity getBaseQuantity()
public final java.lang.String getID()
getSymbol()
.public final java.lang.String toString()
getID()
.toString
in interface Unit
toString
in class DerivedUnitImpl
public boolean isDimensionless()
isDimensionless
in interface Base
isDimensionless
in interface Unit
isDimensionless
in class DerivedUnitImpl
true
if and only if this base unit is dimensionless
(e.g. "radian").public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception