Package javax.measure.converter
Class LogConverter
- java.lang.Object
-
- javax.measure.converter.UnitConverter
-
- javax.measure.converter.LogConverter
-
- All Implemented Interfaces:
Serializable
public final class LogConverter extends UnitConverter
This class represents a logarithmic converter. Such converter is typically used to create logarithmic unit. For example:[code] Unit
BEL = Unit.ONE.transform(new LogConverter(10).inverse()); [/code] Instances of this class are immutable.
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class javax.measure.converter.UnitConverter
IDENTITY
-
-
Constructor Summary
Constructors Constructor Description LogConverter(double base)
Creates a logarithmic converter having the specified base.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double
convert(double amount)
Converts a double value.double
getBase()
Returns the logarithmic base of 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, equals, hashCode
-
-
-
-
Method Detail
-
getBase
public double getBase()
Returns the logarithmic base of this converter.- Returns:
- the logarithmic base (e.g.
Math.E
for the Natural Logarithm).
-
inverse
public UnitConverter inverse()
Description copied from class:UnitConverter
Returns the inverse of this converter. Ifx
is a valid value, thenx == inverse().convert(convert(x))
to within the accuracy of computer arithmetic.- Specified by:
inverse
in classUnitConverter
- Returns:
- the inverse of this converter.
-
convert
public double convert(double amount)
Description copied from class:UnitConverter
Converts a double value.- Specified by:
convert
in classUnitConverter
- Parameters:
amount
- the numeric value to convert.- Returns:
- the converted numeric value.
-
isLinear
public boolean isLinear()
Description copied from class:UnitConverter
Indicates if this converter is linear. A converter is linear ifconvert(u + v) == convert(u) + convert(v)
andconvert(r * u) == r * convert(u)
. For linear converters the following property always hold:[code] y1 = c1.convert(x1); y2 = c2.convert(x2); then y1*y2 = c1.concatenate(c2).convert(x1*x2)[/code]- Specified by:
isLinear
in classUnitConverter
- Returns:
true
if this converter is linear;false
otherwise.
-
-