Class ExpConverter

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<javax.measure.UnitConverter>, javax.measure.UnitConverter, tech.uom.lib.common.function.ValueSupplier<java.lang.String>

    public final class ExpConverter
    extends AbstractConverter
    implements tech.uom.lib.common.function.ValueSupplier<java.lang.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:
    Serialized Form
    • Field Detail

      • base

        private final double base
        Holds the logarithmic base.
      • logOfBase

        private final double logOfBase
        Holds the natural logarithm of the base.
    • Constructor Detail

      • ExpConverter

        public ExpConverter​(double base)
        Creates a logarithmic converter having the specified base.
        Parameters:
        base - the logarithmic base (e.g. Math.E for the Natural Logarithm).
    • Method Detail

      • of

        public static ExpConverter of​(double base)
        Creates a logarithmic converter having the specified base.
        Parameters:
        base - the logarithmic base (e.g. Math.E for the Natural Logarithm).
      • getBase

        public double getBase()
        Returns the exponential base of this converter.
        Returns:
        the exponential base (e.g. Math.E for the Natural Exponential).
      • isIdentity

        public boolean isIdentity()
        Specified by:
        isIdentity in interface javax.measure.UnitConverter
      • inverseWhenNotIdentity

        public AbstractConverter inverseWhenNotIdentity()
        Description copied from class: AbstractConverter
        Non-API

        Returns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.

        Specified by:
        inverseWhenNotIdentity in class AbstractConverter
        Returns:
      • transformationLiteral

        public final java.lang.String transformationLiteral()
        Description copied from class: AbstractConverter
        Non-API

        Returns a String describing the transformation that is represented by this converter. Contributes to converter's toString method. If null or empty toString output becomes simplified.

        Specified by:
        transformationLiteral in class AbstractConverter
        Returns:
      • convertWhenNotIdentity

        public java.math.BigDecimal convertWhenNotIdentity​(java.math.BigDecimal value,
                                                           java.math.MathContext ctx)
                                                    throws java.lang.ArithmeticException
        Description copied from class: AbstractConverter
        Non-API
        Specified by:
        convertWhenNotIdentity in class AbstractConverter
        Returns:
        transformed value
        Throws:
        java.lang.ArithmeticException
      • isLinear

        public boolean isLinear()
        Specified by:
        isLinear in interface javax.measure.UnitConverter
      • getValue

        public java.lang.String getValue()
        Specified by:
        getValue in interface tech.uom.lib.common.function.ValueSupplier<java.lang.String>
      • compareTo

        public int compareTo​(javax.measure.UnitConverter o)
        Specified by:
        compareTo in interface java.lang.Comparable<javax.measure.UnitConverter>