|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectucar.units.UnitImpl
public abstract class UnitImpl
Provides support for classes that implement units.
| Nested Class Summary | |
|---|---|
protected static class |
UnitImpl.MyConverter
Provides support for converting numeric values from this unit to another unit. |
| Constructor Summary | |
|---|---|
protected |
UnitImpl()
Constructs with no ID. |
protected |
UnitImpl(UnitName id)
Constructs with the given ID. |
| Method Summary | |
|---|---|
double[] |
convertTo(double[] amounts,
Unit outputUnit)
Converts numeric values from this unit to another unit. |
double[] |
convertTo(double[] input,
Unit outputUnit,
double[] output)
Converts numeric values from this unit to another unit. |
double |
convertTo(double amount,
Unit outputUnit)
Converts a numeric value from this unit to another unit. |
float[] |
convertTo(float[] amounts,
Unit outputUnit)
Converts numeric values from this unit to another unit. |
float[] |
convertTo(float[] input,
Unit outputUnit,
float[] output)
Converts numeric values from this unit to another unit. |
float |
convertTo(float amount,
Unit outputUnit)
Converts a numeric value from this unit to another unit. |
Unit |
divideBy(Unit that)
Divides this unit by another. |
Unit |
divideInto(Unit that)
Divides this unit into another. |
boolean |
equals(java.lang.Object object)
Indicates if this unit is semantically identical to an object. |
Converter |
getConverterTo(Unit outputUnit)
Gets a Converter for converting numeric values from this unit to another, compatible unit. |
java.lang.String |
getName()
Gets the name of the unit. |
java.lang.String |
getPlural()
Gets the plural form of the name of the unit. |
java.lang.String |
getSymbol()
Gets the symbol for the unit. |
UnitName |
getUnitName()
Gets the identifier of this unit. |
boolean |
isCompatible(Unit that)
Indicates if numeric values in this unit are convertible with another unit. |
java.lang.String |
makeLabel(java.lang.String quantityID)
Returns a label for a quantity in this unit. |
Unit |
multiplyBy(Unit that)
Multiplies this unit by another. |
protected abstract Unit |
myDivideBy(Unit unit)
Divides this unit by another. |
protected abstract Unit |
myDivideInto(Unit unit)
Divides this unit into another. |
protected abstract Unit |
myMultiplyBy(Unit that)
Multiplies this unit by another. |
protected abstract Unit |
myRaiseTo(int power)
Raises this unit to a power. |
Unit |
raiseTo(int power)
Raises this unit to a power. |
java.lang.String |
toString()
Returns the string representation of this unit. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface ucar.units.Unit |
|---|
clone, getCanonicalString, getDerivedUnit, isDimensionless |
| Constructor Detail |
|---|
protected UnitImpl()
protected UnitImpl(UnitName id)
id - The id of the unit (e.g. "foot"). May be
null.| Method Detail |
|---|
public final UnitName getUnitName()
getUnitName in interface Unitnull.public final java.lang.String getName()
getName in interface Unitnull.public final java.lang.String getPlural()
getPlural in interface Unitnull.public final java.lang.String getSymbol()
getSymbol in interface Unitnull.
public final Unit multiplyBy(Unit that)
throws MultiplyException
multiplyBy in interface Unitthat - The other unit.
MultiplyException - Can't multiply these units.
protected abstract Unit myMultiplyBy(Unit that)
throws MultiplyException
that - The other unit.
MultiplyException - Can't multiply these units.
public final Unit divideBy(Unit that)
throws OperationException
divideBy in interface Unitthat - The other unit.
OperationException - Can't divide these units.
protected abstract Unit myDivideBy(Unit unit)
throws OperationException
unit - The other unit.
OperationException - Can't divide these units.
public final Unit divideInto(Unit that)
throws OperationException
divideInto in interface Unitthat - The other unit.
OperationException - Can't divide these units.
protected abstract Unit myDivideInto(Unit unit)
throws OperationException
unit - The other unit.
OperationException - Can't divide these units.
public final Unit raiseTo(int power)
throws RaiseException
raiseTo in interface Unitpower - The power.
RaiseException - Can't raise this unit to a power.
protected abstract Unit myRaiseTo(int power)
throws RaiseException
power - The power.
RaiseException - Can't raise this unit to a power.
public Converter getConverterTo(Unit outputUnit)
throws ConversionException
getConverterTo in interface UnitoutputUnit - The unit to which to convert the numeric
values.
ConversionException - The units aren't convertible.
public float convertTo(float amount,
Unit outputUnit)
throws ConversionException
convertTo in interface Unitamount - The numeric value.outputUnit - The unit to which to convert the numeric
value.
ConversionException - The units aren't convertible.
public double convertTo(double amount,
Unit outputUnit)
throws ConversionException
convertTo in interface Unitamount - The numeric value.outputUnit - The unit to which to convert the numeric
value.
ConversionException - The units aren't convertible.
public float[] convertTo(float[] amounts,
Unit outputUnit)
throws ConversionException
convertTo in interface Unitamounts - The numeric values.outputUnit - The unit to which to convert the numeric
values.
ConversionException - The units aren't convertible.
public double[] convertTo(double[] amounts,
Unit outputUnit)
throws ConversionException
convertTo in interface Unitamounts - The numeric values.outputUnit - The unit to which to convert the numeric
values.
ConversionException - The units aren't convertible.
public float[] convertTo(float[] input,
Unit outputUnit,
float[] output)
throws ConversionException
convertTo in interface Unitinput - The input numeric values.outputUnit - The unit to which to convert the numeric
values.output - The output numeric values. May be the same
array as the input values.
ConversionException - The units aren't convertible.
public double[] convertTo(double[] input,
Unit outputUnit,
double[] output)
throws ConversionException
convertTo in interface Unitinput - The input numeric values.outputUnit - The unit to which to convert the numeric
values.output - The output numeric values. May be the same
array as the input values.
ConversionException - The units aren't convertible.public boolean isCompatible(Unit that)
isCompatible in interface Unitthat - The other unit.
true if and only if numeric
values in this unit are convertible the other
unit.public boolean equals(java.lang.Object object)
equals in interface Unitequals in class java.lang.Objectobject - The object.
true if and only if this unit
is semantically identical to the object.public java.lang.String toString()
toString in interface UnittoString in class java.lang.Objectpublic java.lang.String makeLabel(java.lang.String quantityID)
makeLabel in interface UnitquantityID - The identifier for the quantity (e.g.
"altitude").
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||