@Immutable public final class LogarithmicUnit extends UnitImpl implements DerivableUnit
UnitImpl.MyConverter
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
Unit |
clone(UnitName id)
Clones this unit, changing the identifier.
|
boolean |
equals(java.lang.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.
|
java.lang.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.
|
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.
|
java.lang.String |
toString()
Returns the string representation of this unit.
|
convertTo, convertTo, convertTo, convertTo, convertTo, convertTo, divideBy, divideInto, getConverterTo, getName, getPlural, getSymbol, getUnitName, isCompatible, log, makeLabel, multiplyBy, multiplyBy, raiseTo, shiftTo, shiftTo
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.java.lang.IllegalArgumentException
- if reference
isn't a DerivableUnit
.java.lang.IllegalArgumentException
- if base
isn't one of the allowed values.java.lang.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.java.lang.IllegalArgumentException
- if reference
isn't a DerivableUnit
.java.lang.IllegalArgumentException
- if base
isn't one of the allowed values.java.lang.NullPointerException
- if reference
is null
.public DerivableUnit getReference()
public double getBase()
protected Unit myMultiplyBy(Unit that) throws MultiplyException
myMultiplyBy
in class UnitImpl
that
- 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 UnitImpl
that
- The unit to divide this unit by.that
.DivideException
- Can't divide these units.protected Unit myDivideInto(Unit that) throws OperationException
myDivideInto
in class UnitImpl
that
- 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 UnitImpl
power
- 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 DerivableUnit
getDerivedUnit
in interface Unit
public float toDerivedUnit(float amount) throws ConversionException
toDerivedUnit
in interface DerivableUnit
amount
- The value in this unit.ConversionException
- Can't convert between units.public double toDerivedUnit(double amount) throws ConversionException
toDerivedUnit
in interface DerivableUnit
amount
- The value in this unit.ConversionException
- Can't convert between units.public float[] toDerivedUnit(float[] input, float[] output) throws ConversionException
toDerivedUnit
in interface DerivableUnit
input
- 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 DerivableUnit
input
- 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 DerivableUnit
amount
- The value in the convertible derived unit.ConversionException
- Can't convert between units.public double fromDerivedUnit(double amount) throws ConversionException
fromDerivedUnit
in interface DerivableUnit
amount
- 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 DerivableUnit
input
- 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 DerivableUnit
input
- 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(java.lang.Object object)
public int hashCode()
public boolean isDimensionless()
isDimensionless
in interface Unit
true
, always.public java.lang.String toString()
public java.lang.String getCanonicalString()
getCanonicalString
in interface Unit