|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectucar.units.UnitImpl
ucar.units.DerivedUnitImpl
public class DerivedUnitImpl
Provides support for a concrete implementation of derived units.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ucar.units.UnitImpl |
|---|
UnitImpl.MyConverter |
| Field Summary | |
|---|---|
static DerivedUnitImpl |
DIMENSIONLESS
The dimensionless derived unit. |
| Constructor Summary | |
|---|---|
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. |
| Method Summary | |
|---|---|
Unit |
clone(UnitName id)
Clones the derived unit changing the identifiers. |
boolean |
equals(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. |
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(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. |
String |
toString()
Returns a string representation of this unit. |
| 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 |
| Field Detail |
|---|
public static final DerivedUnitImpl DIMENSIONLESS
| Constructor Detail |
|---|
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.| Method Detail |
|---|
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.public final Unit clone(UnitName id)
clone in interface Unitid - The identifiers for the new unit.
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)
myRaiseTo in class UnitImplpower - The 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(Object object)
equals in interface Unitequals in class Objectobject - The object
true if and only if this derived unit is
semantically identical to
object.public int hashCode()
hashCode in class UnitImplpublic boolean isDimensionless()
isDimensionless in interface Unittrue if and only if this derived unit is
dimensionless.public String toString()
toString in interface UnittoString in class UnitImplpublic String getCanonicalString()
getCanonicalString in interface Unit
public static void main(String[] args)
throws Exception
Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||