public class DerivedUnitImpl extends UnitImpl implements DerivedUnit, DerivableUnit
UnitImpl.MyConverter| Modifier and Type | Field and Description |
|---|---|
static DerivedUnitImpl |
DIMENSIONLESS
The dimensionless derived unit.
|
| Modifier | Constructor and Description |
|---|---|
protected |
DerivedUnitImpl()
Constructs a dimensionless derived unit from nothing.
|
protected |
DerivedUnitImpl(UnitDimension dimension)
Constructs from a unit dimension.
|
protected |
DerivedUnitImpl(UnitDimension dimension,
UnitName id)
Constructs from a unit dimension and identifiers.
|
protected |
DerivedUnitImpl(UnitName id)
Constructs from identifiers.
|
| Modifier and Type | Method and Description |
|---|---|
Unit |
clone(UnitName id)
Clones the derived unit changing the identifiers.
|
boolean |
equals(java.lang.Object object)
Indicates if this derived unit is semantically identical to an object.
|
double |
fromDerivedUnit(double amount)
Converts a numerical value to this unit from the derived unit.
|
double[] |
fromDerivedUnit(double[] input,
double[] output)
Converts numerical values to this unit from the derived unit.
|
float |
fromDerivedUnit(float amount)
Converts a numerical value to this unit from the derived unit.
|
float[] |
fromDerivedUnit(float[] input,
float[] output)
Converts numerical values to this unit from the derived unit.
|
java.lang.String |
getCanonicalString()
Returns the canonical string representation of the unit.
|
DerivedUnit |
getDerivedUnit()
Returns the derived unit that is convertible with this unit.
|
UnitDimension |
getDimension()
Returns the unit dimension of this derived unit.
|
QuantityDimension |
getQuantityDimension()
Returns the quantity dimension of this derived unit.
|
int |
hashCode()
Returns the hash code of this instance.
|
boolean |
isCompatible(Unit that)
Indicates if values in this unit are convertible with another unit.
|
boolean |
isDimensionless()
Indicates if this derived unit is dimensionless.
|
boolean |
isReciprocalOf(DerivedUnit that)
Indicates if this derived unit is the reciprocal of another derived unit
(e.g.
|
static void |
main(java.lang.String[] args)
Tests this class.
|
protected Unit |
myDivideBy(Unit that)
Divides this derived unit by another.
|
protected Unit |
myDivideInto(Unit that)
Divides this derived unit into another.
|
protected Unit |
myMultiplyBy(Unit that)
Multiplies this derived unit by another.
|
protected Unit |
myRaiseTo(int power)
Raises this derived unit to a power.
|
protected void |
setDimension(UnitDimension dimension)
Sets the unit dimension of this derived unit.
|
double |
toDerivedUnit(double amount)
Converts a numerical value from this unit to the derived unit.
|
double[] |
toDerivedUnit(double[] input,
double[] output)
Converts numerical values from this unit to the derived unit.
|
float |
toDerivedUnit(float amount)
Converts a numerical value from this unit to the derived unit.
|
float[] |
toDerivedUnit(float[] input,
float[] output)
Converts numerical values from this unit to the derived unit.
|
java.lang.String |
toString()
Returns a string representation of this unit.
|
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftToclone, finalize, getClass, notify, notifyAll, wait, wait, waitconvertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTopublic static final DerivedUnitImpl DIMENSIONLESS
protected DerivedUnitImpl()
protected DerivedUnitImpl(UnitDimension dimension)
dimension - The unit dimension.protected DerivedUnitImpl(UnitName id)
id - The identifiers for the unit.protected DerivedUnitImpl(UnitDimension dimension, UnitName id)
dimension - The unit dimension.id - The identifiers for the unit.protected void setDimension(UnitDimension dimension)
dimension - The unit dimension.public final UnitDimension getDimension()
getDimension in interface DerivedUnitpublic final QuantityDimension getQuantityDimension()
getQuantityDimension in interface DerivedUnitpublic final boolean isReciprocalOf(DerivedUnit that)
isReciprocalOf in interface DerivedUnitthat - The other, derived unit.public final DerivedUnit getDerivedUnit()
getDerivedUnit in interface DerivableUnitgetDerivedUnit in interface Unitthis.protected Unit myMultiplyBy(Unit that) throws MultiplyException
myMultiplyBy in class UnitImplthat - The other unit.MultiplyException - Can't multiply these units.protected Unit myDivideBy(Unit that) throws OperationException
myDivideBy in class UnitImplthat - The other unit.OperationException - Can't divide these units.protected Unit myDivideInto(Unit that) throws OperationException
myDivideInto in class UnitImplthat - The other unit.OperationException - Can't divide these units.protected Unit myRaiseTo(int power)
public final float toDerivedUnit(float amount)
toDerivedUnit in interface DerivableUnitamount - The numerical values in this unit.public final double toDerivedUnit(double amount)
toDerivedUnit in interface DerivableUnitamount - The numerical values in this unit.public final float[] toDerivedUnit(float[] input,
float[] output)
toDerivedUnit in interface DerivableUnitinput - The numerical values in this unit.output - The numerical values in the derived unit. May be the same
array as input.output.public final double[] toDerivedUnit(double[] input,
double[] output)
toDerivedUnit in interface DerivableUnitinput - The numerical values in this unit.output - The numerical values in the derived unit. May be the same
array as input.output.public final float fromDerivedUnit(float amount)
fromDerivedUnit in interface DerivableUnitamount - The numerical values in the derived unit.public final double fromDerivedUnit(double amount)
fromDerivedUnit in interface DerivableUnitamount - The numerical values in the derived unit.public final float[] fromDerivedUnit(float[] input,
float[] output)
fromDerivedUnit in interface DerivableUnitinput - The numerical values in the derived unit.output - The numerical values in this unit. May be the same array as
input.output.public final double[] fromDerivedUnit(double[] input,
double[] output)
fromDerivedUnit in interface DerivableUnitinput - The numerical values in the derived unit.output - The numerical values in this unit. May be the same array as
input.output.public final boolean isCompatible(Unit that)
isCompatible in interface UnitisCompatible in class UnitImplthat - The other unit.true if and only if values in this unit are
convertible to values in
that.public boolean equals(java.lang.Object object)
public int hashCode()
public boolean isDimensionless()
isDimensionless in interface Unittrue if and only if this derived unit is
dimensionless.public java.lang.String toString()
public java.lang.String getCanonicalString()
getCanonicalString in interface Unitpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception