|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.measure.converter.UnitConverter
javax.measure.converter.LogConverter
public final class LogConverter
This class represents a logarithmic converter. Such converter
is typically used to create logarithmic unit. For example:
Unit<Dimensionless> BEL = Unit.ONE.transform(new LogConverter(10).inverse());
Instances of this class are immutable.
Field Summary |
---|
Fields inherited from class javax.measure.converter.UnitConverter |
---|
IDENTITY |
Constructor Summary | |
---|---|
LogConverter(double base)
Creates a logarithmic converter having the specified base. |
Method Summary | |
---|---|
double |
convert(double amount)
Converts a double value. |
boolean |
equals(java.lang.Object obj)
Indicates whether this converter is considered the same as the converter specified (they must be of same types). |
double |
getBase()
Returns the logarithmic base of this converter. |
int |
hashCode()
Returns a hash code value for this converter. |
UnitConverter |
inverse()
Returns the inverse of this converter. |
boolean |
isLinear()
Indicates if this converter is linear. |
Methods inherited from class javax.measure.converter.UnitConverter |
---|
concatenate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LogConverter(double base)
base
- the logarithmic base (e.g. Math.E
for
the Natural Logarithm).Method Detail |
---|
public double getBase()
Math.E
for
the Natural Logarithm).public UnitConverter inverse()
UnitConverter
x
is a valid
value, then x == inverse().convert(convert(x))
to within
the accuracy of computer arithmetic.
inverse
in class UnitConverter
public double convert(double amount)
UnitConverter
convert
in class UnitConverter
amount
- the numeric value to convert.
public boolean isLinear()
UnitConverter
convert(u + v) == convert(u) + convert(v)
and
convert(r * u) == r * convert(u)
.
For linear converters the following property always hold:
y1 = c1.convert(x1);
y2 = c2.convert(x2);
then y1*y2 = c1.concatenate(c2).convert(x1*x2)
isLinear
in class UnitConverter
true
if this converter is linear;
false
otherwise.public boolean equals(java.lang.Object obj)
UnitConverter
equals
in class UnitConverter
obj
- the converter with which to compare.
true
if the specified object is a converter
considered equals to this converter;false
otherwise.public int hashCode()
UnitConverter
hashCode
in class UnitConverter
UnitConverter.equals(java.lang.Object)
|
JSR-275 - Measurements and Units Specification | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |