Class ExpConverter
java.lang.Object
tech.units.indriya.AbstractConverter
tech.units.indriya.function.ExpConverter
- All Implemented Interfaces:
Serializable, Comparable<javax.measure.UnitConverter>, javax.measure.UnitConverter, tech.uom.lib.common.function.ValueSupplier<String>
public final class ExpConverter
extends AbstractConverter
implements tech.uom.lib.common.function.ValueSupplier<String>
This class represents a exponential converter of limited precision. Such converter is used to create inverse of logarithmic unit.
This class is package private, instances are created using the AbstractConverter.inverse() method.
- Since:
- 1.0
- Version:
- 1.3, April 26, 2018
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractConverter
AbstractConverter.Pair -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleHolds the logarithmic base.private final doubleHolds the natural logarithm of the base.private static final longFields inherited from class AbstractConverter
conversionSteps, IDENTITY -
Constructor Summary
ConstructorsConstructorDescriptionExpConverter(double base) Creates a logarithmic converter having the specified base. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(javax.measure.UnitConverter o) doubleconvertWhenNotIdentity(double amount) Non-APIconvertWhenNotIdentity(BigDecimal value, MathContext ctx) Non-APIbooleandoublegetBase()Returns the exponential base of this converter.getValue()inthashCode()Non-APIbooleanbooleanisLinear()protected booleanNon-API Guard forAbstractConverter.simpleCompose(AbstractConverter)static ExpConverterof(double base) Creates a logarithmic converter having the specified base.protected AbstractConverterNon-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)final StringNon-APIMethods inherited from class AbstractConverter
concatenate, convert, convert, convertWhenNotIdentity, getConversionSteps, inverse, of, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
base
private final double baseHolds the logarithmic base. -
logOfBase
private final double logOfBaseHolds the natural logarithm of the base.
-
-
Constructor Details
-
ExpConverter
public ExpConverter(double base) Creates a logarithmic converter having the specified base.- Parameters:
base- the logarithmic base (e.g.Math.Efor the Natural Logarithm).
-
-
Method Details
-
of
Creates a logarithmic converter having the specified base.- Parameters:
base- the logarithmic base (e.g.Math.Efor the Natural Logarithm).
-
getBase
public double getBase()Returns the exponential base of this converter.- Returns:
- the exponential base (e.g.
Math.Efor the Natural Exponential).
-
isIdentity
public boolean isIdentity()- Specified by:
isIdentityin interfacejavax.measure.UnitConverter
-
isSimpleCompositionWith
Description copied from class:AbstractConverterNon-API Guard forAbstractConverter.simpleCompose(AbstractConverter)- Specified by:
isSimpleCompositionWithin classAbstractConverter- Parameters:
that-- Returns:
- whether or not a 'simple' composition of transformations is possible
-
simpleCompose
Description copied from class:AbstractConverterNon-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)- Overrides:
simpleComposein classAbstractConverter- Parameters:
that-- Returns:
- a new AbstractConverter that adds no additional conversion step
-
inverseWhenNotIdentity
Description copied from class:AbstractConverterNon-APIReturns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.
- Specified by:
inverseWhenNotIdentityin classAbstractConverter- Returns:
-
transformationLiteral
Description copied from class:AbstractConverterNon-APIReturns a String describing the transformation that is represented by this converter. Contributes to converter's
toStringmethod. If null or emptytoStringoutput becomes simplified.- Specified by:
transformationLiteralin classAbstractConverter- Returns:
-
equals
- Specified by:
equalsin classAbstractConverter
-
hashCode
public int hashCode()- Specified by:
hashCodein classAbstractConverter
-
convertWhenNotIdentity
public double convertWhenNotIdentity(double amount) Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Parameters:
amount-- Returns:
- transformed value
-
convertWhenNotIdentity
public BigDecimal convertWhenNotIdentity(BigDecimal value, MathContext ctx) throws ArithmeticException Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Parameters:
value-ctx-- Returns:
- transformed value
- Throws:
ArithmeticException
-
isLinear
public boolean isLinear()- Specified by:
isLinearin interfacejavax.measure.UnitConverter
-
getValue
-
compareTo
public int compareTo(javax.measure.UnitConverter o) - Specified by:
compareToin interfaceComparable<javax.measure.UnitConverter>
-