Package javax.measure.converter
Class LogConverter
java.lang.Object
javax.measure.converter.UnitConverter
javax.measure.converter.LogConverter
- All Implemented Interfaces:
Serializable
This class represents a logarithmic converter. Such converter
is typically used to create logarithmic unit. For example:[code]
Unit
Instances of this class are immutable.
- See Also:
-
Field Summary
Fields inherited from class javax.measure.converter.UnitConverter
IDENTITY -
Constructor Summary
ConstructorsConstructorDescriptionLogConverter(double base) Creates a logarithmic converter having the specified base. -
Method Summary
Methods inherited from class javax.measure.converter.UnitConverter
concatenate, equals, hashCode
-
Constructor Details
-
LogConverter
public LogConverter(double base) Creates a logarithmic converter having the specified base.- Parameters:
base- the logarithmic base (e.g.Math.Efor the Natural Logarithm).
-
-
Method Details
-
getBase
public double getBase()Returns the logarithmic base of this converter.- Returns:
- the logarithmic base (e.g.
Math.Efor the Natural Logarithm).
-
inverse
Description copied from class:UnitConverterReturns the inverse of this converter. Ifxis a valid value, thenx == inverse().convert(convert(x))to within the accuracy of computer arithmetic.- Specified by:
inversein classUnitConverter- Returns:
- the inverse of this converter.
-
convert
public double convert(double amount) Description copied from class:UnitConverterConverts a double value.- Specified by:
convertin classUnitConverter- Parameters:
amount- the numeric value to convert.- Returns:
- the converted numeric value.
-
isLinear
public boolean isLinear()Description copied from class:UnitConverterIndicates 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:
isLinearin classUnitConverter- Returns:
trueif this converter is linear;falseotherwise.
-