|
||||||||||
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 DerivedUnit
public final QuantityDimension getQuantityDimension()
getQuantityDimension
in interface DerivedUnit
public final boolean isReciprocalOf(DerivedUnit that)
isReciprocalOf
in interface DerivedUnit
that
- The other, derived unit.public final DerivedUnit getDerivedUnit()
getDerivedUnit
in interface DerivableUnit
getDerivedUnit
in interface Unit
this
.public final Unit clone(UnitName id)
clone
in interface Unit
id
- The identifiers for the new unit.
protected Unit myMultiplyBy(Unit that) throws MultiplyException
myMultiplyBy
in class UnitImpl
that
- The other unit.
MultiplyException
- Can't multiply these units.protected Unit myDivideBy(Unit that) throws OperationException
myDivideBy
in class UnitImpl
that
- The other unit.
OperationException
- Can't divide these units.protected Unit myDivideInto(Unit that) throws OperationException
myDivideInto
in class UnitImpl
that
- The other unit.
OperationException
- Can't divide these units.protected Unit myRaiseTo(int power)
myRaiseTo
in class UnitImpl
power
- The power.
public final float toDerivedUnit(float amount)
toDerivedUnit
in interface DerivableUnit
amount
- The numerical values in this unit.
public final double toDerivedUnit(double amount)
toDerivedUnit
in interface DerivableUnit
amount
- The numerical values in this unit.
public final float[] toDerivedUnit(float[] input, float[] output)
toDerivedUnit
in interface DerivableUnit
input
- 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 DerivableUnit
input
- 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 DerivableUnit
amount
- The numerical values in the derived unit.
public final double fromDerivedUnit(double amount)
fromDerivedUnit
in interface DerivableUnit
amount
- The numerical values in the derived unit.
public final float[] fromDerivedUnit(float[] input, float[] output)
fromDerivedUnit
in interface DerivableUnit
input
- 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 DerivableUnit
input
- 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 Unit
isCompatible
in class UnitImpl
that
- 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 Unit
equals
in class Object
object
- The object
true
if and only if this derived unit is
semantically identical to
object
.public int hashCode()
hashCode
in class UnitImpl
public boolean isDimensionless()
isDimensionless
in interface Unit
true
if and only if this derived unit is
dimensionless.public String toString()
toString
in interface Unit
toString
in class UnitImpl
public 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 |