|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectucar.units.UnitImpl
ucar.units.LogarithmicUnit
public final class LogarithmicUnit
Provides support for units that are based on a logarithm of the ratio of a physical quantity to an underlying reference level. Instances of this class are immutable.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class ucar.units.UnitImpl |
|---|
UnitImpl.MyConverter |
| Constructor Summary | |
|---|---|
LogarithmicUnit(Unit reference,
double base)
Constructs from a reference level and a logarithmic base. |
|
LogarithmicUnit(Unit reference,
double base,
UnitName id)
Constructs from a reference level, a logarithmic base, and a unit identifier. |
|
| Method Summary | |
|---|---|
Unit |
clone(UnitName id)
Clones this unit, changing the identifier. |
boolean |
equals(Object object)
Indicates if this unit is semantically identical to an object. |
double |
fromDerivedUnit(double amount)
Converts a value in the convertible derived unit to the equivalent value in this unit. |
double[] |
fromDerivedUnit(double[] input,
double[] output)
Converts values in the convertible derived unit to the equivalent values in this unit. |
float |
fromDerivedUnit(float amount)
Converts a value in the convertible derived unit to the equivalent value in this unit. |
float[] |
fromDerivedUnit(float[] input,
float[] output)
Converts values in the convertible derived unit to the equivalent values in this unit. |
double |
getBase()
Returns the logarithmic base. |
String |
getCanonicalString()
Returns the canonical string representation of the unit. |
DerivedUnit |
getDerivedUnit()
Returns the derived unit that is convertible with this unit. |
DerivableUnit |
getReference()
Returns the reference level. |
int |
hashCode()
Returns the hash code of this instance. |
boolean |
isDimensionless()
Indicates if this unit is dimensionless. |
static void |
main(String[] args)
Tests this class. |
protected Unit |
myDivideBy(Unit that)
Divide this unit by another unit. |
protected Unit |
myDivideInto(Unit that)
Divide this unit into another unit. |
protected Unit |
myMultiplyBy(Unit that)
Multiply this unit by another unit. |
protected Unit |
myRaiseTo(int power)
Raise this unit to a power. |
double |
toDerivedUnit(double amount)
Converts a value in this unit to the equivalent value in the convertible derived unit. |
double[] |
toDerivedUnit(double[] input,
double[] output)
Converts values in this unit to the equivalent values in the convertible derived unit. |
float |
toDerivedUnit(float amount)
Converts a value in this unit to the equivalent value in the convertible derived unit. |
float[] |
toDerivedUnit(float[] input,
float[] output)
Converts values in this unit to the equivalent values in the convertible derived unit. |
String |
toString()
Returns the 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, isCompatible, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public LogarithmicUnit(Unit reference,
double base)
reference - The reference level. Must be a DerivableUnit.base - The logarithmic base. Must be 2, Math.E, or 10.
IllegalArgumentException - if reference isn't a DerivableUnit.
IllegalArgumentException - if base isn't one of the allowed values.
NullPointerException - if reference is null.
public LogarithmicUnit(Unit reference,
double base,
UnitName id)
reference - The reference level. Must be a DerivableUnit.base - The logarithmic base. Must be 2, Math.E, or 10.id - The identifier for the new unit.
IllegalArgumentException - if reference isn't a DerivableUnit.
IllegalArgumentException - if base isn't one of the allowed values.
NullPointerException - if reference is null.| Method Detail |
|---|
public DerivableUnit getReference()
public double getBase()
public Unit clone(UnitName id)
clone in interface Unitid - The identifier for the new unit.
protected Unit myMultiplyBy(Unit that)
throws MultiplyException
myMultiplyBy in class UnitImplthat - The unit to multiply this unit by. Must be dimensionless.
that.
MultiplyException - Can't multiply these units together.
protected Unit myDivideBy(Unit that)
throws DivideException
myDivideBy in class UnitImplthat - The unit to divide this unit by.
that.
DivideException - Can't divide these units.
protected Unit myDivideInto(Unit that)
throws OperationException
myDivideInto in class UnitImplthat - The unit to divide this unit into.
that unit and this unit.
DivideException - Can't divide these units.
OperationException - Can't divide these units.
protected Unit myRaiseTo(int power)
throws RaiseException
myRaiseTo in class UnitImplpower - The power to raise this unit by. The only meaningful values
are 0 and 1.
power.
RaiseException - Can't raise this unit to power, which is neither 0
nor 1.public DerivedUnit getDerivedUnit()
getDerivedUnit in interface DerivableUnitgetDerivedUnit in interface Unit
public float toDerivedUnit(float amount)
throws ConversionException
toDerivedUnit in interface DerivableUnitamount - The value in this unit.
ConversionException - Can't convert between units.
public double toDerivedUnit(double amount)
throws ConversionException
toDerivedUnit in interface DerivableUnitamount - The value in this unit.
ConversionException - Can't convert between units.
public float[] toDerivedUnit(float[] input,
float[] output)
throws ConversionException
toDerivedUnit in interface DerivableUnitinput - The values in this unit.output - The equivalent values in the convertible derived unit. May be
the same array as input.
output.
ConversionException - Can't convert between units.
public double[] toDerivedUnit(double[] input,
double[] output)
throws ConversionException
toDerivedUnit in interface DerivableUnitinput - The values in this unit.output - The equivalent values in the convertible derived unit. May be
the same array as input.
output.
ConversionException - Can't convert between units.
public float fromDerivedUnit(float amount)
throws ConversionException
fromDerivedUnit in interface DerivableUnitamount - The value in the convertible derived unit.
ConversionException - Can't convert between units.
public double fromDerivedUnit(double amount)
throws ConversionException
fromDerivedUnit in interface DerivableUnitamount - The value in the convertible derived unit.
ConversionException - Can't convert between units.
public float[] fromDerivedUnit(float[] input,
float[] output)
throws ConversionException
fromDerivedUnit in interface DerivableUnitinput - The values in the convertible derived unit.output - The equivalent values in this unit. May be the same array as
input.
output.
ConversionException - Can't convert between units.
public double[] fromDerivedUnit(double[] input,
double[] output)
throws ConversionException
fromDerivedUnit in interface DerivableUnitinput - The values in the convertible derived unit.output - The equivalent values in this unit. May be the same array as
input.
output.
ConversionException - Can't convert between units.public boolean equals(Object object)
equals in interface Unitequals in class Objectobject - The object.
true if and only if this unit is semantically
identical to object
.public int hashCode()
hashCode in class UnitImplpublic boolean isDimensionless()
isDimensionless in interface Unittrue, always.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 | ||||||||