Class PowerOf10

All Implemented Interfaces:
Serializable, javax.measure.UnitConverter

final class PowerOf10 extends AbstractConverter
Conversions from units represented by a logarithm in base 10.
Since:
1.0
Version:
1.0
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    private static final class 
    Inverse of PowerOf10.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final javax.measure.UnitConverter
    The singleton instance.
    private static final double
    Value of Math.log(10).
    private static final long
    For cross-version compatibility.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Creates the singleton instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) static javax.measure.UnitConverter
    Returns the converter from bel unit (B) to dimensionless unit.
    double
    convert(double value)
    Applies the unit conversion on the given value.
    double
    derivative(double value)
    Returns the derivative of this conversion at the given value.
    boolean
    equals(Object other)
    Compares this converter with the given object for equality.
    int
    Returns a hash code value for this unit converter.
    javax.measure.UnitConverter
    Returns the inverse of this converter.
    private Object
    Returns the singleton instance on deserialization.
    Returns a string representation of this converter for debugging purpose.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For cross-version compatibility.
      See Also:
    • LN_10

      private static final double LN_10
      Value of Math.log(10).
      See Also:
    • INSTANCE

      private static final javax.measure.UnitConverter INSTANCE
      The singleton instance. Can be used for conversion from neper units to Units.UNITY.
  • Constructor Details

    • PowerOf10

      private PowerOf10()
      Creates the singleton instance.
  • Method Details

    • belToOne

      static javax.measure.UnitConverter belToOne()
      Returns the converter from bel unit (B) to dimensionless unit. ISO 80000-3:2006 defines 1 B = ln(10)/2 Np (neper) and 1 Np = 1 (dimensionless), keeping in mind that neper is a logarithmic scale using the natural logarithm. The ln(10) factor is for converting from base ℯ to base 10.

      The method of expressing a ratio as a level in decibels depends on whether the measured property is a power quantity or a root-power quantity (amplitude of a field). This is because power is often proportional to the square of the amplitude. The /2 in above equation is for taking the square root of a power, since B is used for power and Np is used for root-power.

      The bel represents the logarithm of a ratio between two power quantities of 10:1. Two signals whose levels differ by x bels have a power ratio of 10^x and an amplitude (field quantity) ratio of 10^(x/2).

      See Also:
    • readResolve

      private Object readResolve() throws ObjectStreamException
      Returns the singleton instance on deserialization.
      Throws:
      ObjectStreamException
    • inverse

      public javax.measure.UnitConverter inverse()
      Returns the inverse of this converter.
    • convert

      public double convert(double value)
      Applies the unit conversion on the given value.
    • derivative

      public double derivative(double value)
      Returns the derivative of this conversion at the given value.
      Specified by:
      derivative in class AbstractConverter
      Parameters:
      value - the point at which to compute the derivative. Ignored (can be Double.NaN) if the conversion is linear.
    • equals

      public boolean equals(Object other)
      Compares this converter with the given object for equality.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Returns a hash code value for this unit converter.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Returns a string representation of this converter for debugging purpose.
      Overrides:
      toString in class Object