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
  • 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