|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Unit
Interface for units.
Method Summary | |
---|---|
Unit |
clone(UnitName id)
Clones this unit, changing the identifier. |
double[] |
convertTo(double[] amounts,
Unit outputUnit)
Converts numerical values from this unit to another unit. |
double[] |
convertTo(double[] input,
Unit outputUnit,
double[] output)
Converts numerical values from this unit to another unit. |
double |
convertTo(double amount,
Unit outputUnit)
Converts a numerical value from this unit to another unit. |
float[] |
convertTo(float[] amounts,
Unit outputUnit)
Converts numerical values from this unit to another unit. |
float[] |
convertTo(float[] input,
Unit outputUnit,
float[] output)
Converts numerical values from this unit to another unit. |
float |
convertTo(float amount,
Unit outputUnit)
Converts a numerical 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(Object object)
Indicates if this unit is semantically identical to an object. |
String |
getCanonicalString()
Returns the canonical string representation of the unit. |
Converter |
getConverterTo(Unit outputUnit)
Gets a Converter that converts numeric values from this unit to another, compatible unit. |
DerivedUnit |
getDerivedUnit()
Returns the derived unit that underlies this unit. |
String |
getName()
Gets the name of this unit. |
String |
getPlural()
Gets the plural form of the name of this unit. |
String |
getSymbol()
Gets the symbol of this unit. |
UnitName |
getUnitName()
Gets the identifier of this unit. |
boolean |
isCompatible(Unit that)
Indicates if this unit is compatible with another unit. |
boolean |
isDimensionless()
Indicates if values in this unit are dimensionless. |
Unit |
log(double base)
Returns a logarithmic unit whose reference level is equal to this unit. |
String |
makeLabel(String quantityID)
Makes a label for a named quantity. |
Unit |
multiplyBy(double scale)
Multiplies this unit by a scale factor. |
Unit |
multiplyBy(Unit that)
Multiplies this unit by another. |
Unit |
raiseTo(int power)
Raises this unit to a power. |
Unit |
shiftTo(Date origin)
Returns a unit identical to this instance but whose origin (i.e., zero value) has been shifted to the given time. |
Unit |
shiftTo(double origin)
Returns a unit identical to this instance but whose origin (i.e., zero value) has been shifted to the given value. |
String |
toString()
Returns the string representation of the unit. |
Method Detail |
---|
UnitName getUnitName()
String getName()
String getPlural()
String getSymbol()
String toString()
toString
in class Object
String getCanonicalString()
DerivedUnit getDerivedUnit()
Unit clone(UnitName id)
id
- The identifier for the new unit.
Unit multiplyBy(Unit that) throws MultiplyException
that
- The other unit.
MultiplyException
- Can't multiply these units.Unit multiplyBy(double scale) throws MultiplyException
m
is a
meter unit, then m.multiplyBy(1e-2)
returns a centimeter unit.
scale
- The scale factor.
MultiplyException
- if scale
is zero.Unit divideBy(Unit that) throws OperationException
that
- The other unit.
OperationException
- Can't divide these units.Unit divideInto(Unit that) throws OperationException
that
- The other unit.
OperationException
- Can't divide these units.Unit raiseTo(int power) throws RaiseException
power
- The power.
RaiseException
- Can't raise this unit to a power.Unit shiftTo(double origin) throws ShiftException
degK
is a Kelvin unit, then degK.shiftTo(273.15)
is a Celsius unit.
origin
- The new origin in units of this instance.
origin
of this instance.
ShiftException
- if the corresponding new unit can't be created.Unit shiftTo(Date origin) throws ShiftException
sec
is
a second unit, then sec.shiftTo(new Date(0L)
is the unit
corresponding to seconds since the epoch (1970-01-01 00:00:00 UTC).
origin
- The new origin.
origin
.
ShiftException
- if the corresponding new unit can't be created. For example,
if this instance isn't a unit of time.Unit log(double base)
mW
is a milliwatt unit, then mW.log(10.)
returns a base-ten logarithmic unit with a milliwatt reference level.
base
- The logarithmic base. Must be one of 2
, Math.E
, or 10
.
IllegalArgumentException
- if base
isn't one of the allowed values.Converter getConverterTo(Unit outputUnit) throws ConversionException
outputUnit
- The unit to which to convert the numerical values.
ConversionException
- The units aren't compatible.float convertTo(float amount, Unit outputUnit) throws ConversionException
amount
- The numerical value in this unit.outputUnit
- The unit to which to convert the numerical value.
ConversionException
- The units aren't compatible.double convertTo(double amount, Unit outputUnit) throws ConversionException
amount
- The numerical value in this unit.outputUnit
- The unit to which to convert the numerical value.
ConversionException
- The units aren't compatible.float[] convertTo(float[] amounts, Unit outputUnit) throws ConversionException
amounts
- The numerical values in this unit.outputUnit
- The unit to which to convert the numerical values.
ConversionException
- The units aren't compatible.double[] convertTo(double[] amounts, Unit outputUnit) throws ConversionException
amounts
- The numerical values in this unit.outputUnit
- The unit to which to convert the numerical values.
ConversionException
- The units aren't compatible.float[] convertTo(float[] input, Unit outputUnit, float[] output) throws ConversionException
input
- The numerical values in this unit.outputUnit
- The unit to which to convert the numerical values.output
- The output numerical values. May be the same array as the
input values.
output
.
ConversionException
- The units aren't compatible.double[] convertTo(double[] input, Unit outputUnit, double[] output) throws ConversionException
input
- The numerical values in this unit.outputUnit
- The unit to which to convert the numerical values.output
- The output numerical values. May be the same array as the
input values.
output
.
ConversionException
- The units aren't compatible.boolean isCompatible(Unit that)
that
- The other unit.
boolean equals(Object object)
equals
in class Object
object
- The object.
true
if and only if this unit is semantically
identical to the object.String makeLabel(String quantityID)
quantityID
- An identifier of the quantity for which the label is intended
(e.g. "altitude").
boolean isDimensionless()
true
if and only if this unit is dimensionless.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |