Documentation of 'visad.LogarithmicUnit' Java class
LogarithmicUnit
visad

Class LogarithmicUnit

  • All Implemented Interfaces:
    java.io.Serializable


    public final class LogarithmicUnit
    extends Unit
    implements java.io.Serializable
    A class that represents a scaled unit with an offset. Instances are immutable.
    See Also:
    Serialized Form
    • Method Detail

      • isDimensionless

        public boolean isDimensionless()
        Indicates if this instance is dimensionless. Logarithmic units are dimensionless by definition.
        Specified by:
        isDimensionless in class Unit
        Returns:
        true always.
      • scale

        public Unit scale(double scale)
                   throws UnitException
        Description copied from class: Unit
        Scale this unit by an amount.
        Specified by:
        scale in class Unit
        Parameters:
        scale - The amount by which to scale this unit. E.g. Unit yard = meter.scale(0.9144);
        Returns:
        A unit equal to this instance scaled by the given amount.
        Throws:
        UnitException - This unit cannot be scaled.
      • shift

        public Unit shift(double offset)
                   throws UnitException
        Description copied from class: Unit
        Shift this unit by an amount.
        Specified by:
        shift in class Unit
        Parameters:
        offset - The amount by which to shift this unit. E.g. Unit celsius = kelvin.shift(273.15);
        Returns:
        A unit equal to this instance with the origin shifted by the given amount.
        Throws:
        UnitException - The unit subclass is unknown.
      • log

        public Unit log(double base)
                 throws UnitException
        Description copied from class: Unit
        Returns the logarithmic unit that has this unit as its reference level. Not all units can be used as a reference level.
        Specified by:
        log in class Unit
        Parameters:
        base - The logarithmic base: one of 2, Math.E, or 10.
        Returns:
        The logarithmic unit that has this instance as its reference level.
        Throws:
        UnitException - if this unit can't be used as a reference level for a logarithmic unit.
      • pow

        public Unit pow(int power)
        Raises this unit to a power. Only certain powers are meaningful.
        Specified by:
        pow in class Unit
        Parameters:
        power - The power to raise this unit by. The only meaningful values are 0 and 1.
        Returns:
        The result of raising this unit to the given power.
        Throws:
        java.lang.IllegalArgumentException - if power isn't 0 or 1.
      • pow

        public Unit pow(double power)
        Raises this unit to a power. Only certain powers are meaningful.
        Specified by:
        pow in class Unit
        Parameters:
        power - The power to raise this unit by. The only meaningful values are 0 and 1.
        Returns:
        The result of raising this unit to the given power.
      • root

        public Unit root(int root)
                  throws java.lang.IllegalArgumentException
        Returns the N-th root of this unit. Only the 1st root is meaningful.
        Specified by:
        root in class Unit
        Parameters:
        root - The root to take. Must be 1.
        Returns:
        This instance.
        Throws:
        java.lang.IllegalArgumentException - if root isn't 1.
      • getDefinition

        public java.lang.String getDefinition()
        Return the definition of this unit as a string.
        Specified by:
        getDefinition in class Unit
        Returns:
        The definition of this unit (e.g., "lg(re 0.001 W)") for a Bel unit with a milliwatt reference level.
      • multiply

        public Unit multiply(Unit that)
                      throws UnitException
        Multiply this unit by another unit. Only certain other units are meaningful.
        Specified by:
        multiply in class Unit
        Parameters:
        that - The unit with which to multiply this unit. Must be dimensionless.
        Returns:
        A unit equal to this instance multiplied by the given unit.
        Throws:
        java.lang.IllegalArgumentException - if that isn't dimensionless.
        UnitException - Can't multiply units.
      • divide

        public Unit divide(Unit that)
                    throws UnitException
        Divide this unit by another unit. Only certain other units are meaningful.
        Specified by:
        divide in class Unit
        Parameters:
        that - The unit to divide into this unit. Must be dimensionless.
        Returns:
        A unit equal to this instance divided by the given unit.
        Throws:
        UnitException - Can't divide units.
      • toThis

        public double[] toThis(double[] values,
                               Unit that)
                        throws UnitException
        Convert values to this unit from another unit.
        Specified by:
        toThis in class Unit
        Parameters:
        values - The values to be converted.
        that - The unit of values.
        Returns:
        The converted values in units of this unit. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThis

        public float[] toThis(float[] values,
                              Unit that)
                       throws UnitException
        Convert values to this unit from another unit.
        Specified by:
        toThis in class Unit
        Parameters:
        values - The values to be converted.
        that - The unit of values.
        Returns:
        The converted values in units of this unit. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThis

        public double[] toThis(double[] values,
                               Unit that,
                               boolean copy)
                        throws UnitException
        Convert values to this unit from another unit.
        Overrides:
        toThis in class Unit
        Parameters:
        values - The values to be converted.
        that - The unit of values.
        copy - if false and that equals this, return values, else return a new array
        Returns:
        The converted values in units of this unit. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThis

        public float[] toThis(float[] values,
                              Unit that,
                              boolean copy)
                       throws UnitException
        Convert values to this unit from another unit.
        Overrides:
        toThis in class Unit
        Parameters:
        values - The values to be converted.
        that - The unit of values.
        copy - if false, convert values in place.
        Returns:
        The converted values in units of this unit. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThat

        public double[] toThat(double[] values,
                               Unit that)
                        throws UnitException
        Convert values from this unit to another unit.
        Specified by:
        toThat in class Unit
        Parameters:
        values - The values to be converted in units of this unit.
        that - The unit to which to convert the values.
        Returns:
        The converted values. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThat

        public float[] toThat(float[] values,
                              Unit that)
                       throws UnitException
        Convert values from this unit to another unit.
        Specified by:
        toThat in class Unit
        Parameters:
        values - The values to be converted in units of this unit.
        that - The unit to which to convert the values.
        Returns:
        The converted values. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThat

        public double[] toThat(double[] values,
                               Unit that,
                               boolean copy)
                        throws UnitException
        Convert values from this unit to another unit.
        Overrides:
        toThat in class Unit
        Parameters:
        values - The values to be converted in units of this unit.
        that - The unit to which to convert the values.
        copy - if false and that equals this, return a values, else return a new array
        Returns:
        The converted values. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • toThat

        public float[] toThat(float[] values,
                              Unit that,
                              boolean copy)
                       throws UnitException
        Convert values from this unit to another unit.
        Overrides:
        toThat in class Unit
        Parameters:
        values - The values to be converted in units of this unit.
        that - The unit to which to convert the values.
        copy - if false and that equals this, return a values, else return a new array
        Returns:
        The converted values. require: The units are convertible. promise: Neither unit has been modified.
        Throws:
        UnitException - The units are not convertible.
      • getAbsoluteUnit

        public Unit getAbsoluteUnit()
        Gets the absolute unit of this unit. An interval in the underlying physical quantity has the same numeric value in an absolute unit of a unit as in the unit itself -- but an absolute unit is always referenced to the physical origin of the underlying physical quantity. For example, the absolute unit corresponding to degrees celsius is degrees kelvin -- and calling this method on a degrees celsius unit obtains a degrees kelvin unit.
        Overrides:
        getAbsoluteUnit in class Unit
        Returns:
        The absolute unit corresponding to this unit.
      • isConvertible

        public boolean isConvertible(Unit unit)
        Indicate whether this unit is convertible with another unit. If one unit is convertible with another, then the toThis(...)/ and toThat(...) methods will not throw a UnitException. Unit A is convertible with unit B if and only if unit B is convertible with unit A; hence, calling-order is irrelevant.
        Specified by:
        isConvertible in class Unit
        Parameters:
        unit - The other unit.
        Returns:
        True if and only if this unit is convertible with the other unit.
      • main

        public static void main(java.lang.String[] args)
                         throws UnitException
        Test this class.
        Parameters:
        args - Arguments (ignored).
        Throws:
        UnitException - A problem occurred.
      • equals

        public boolean equals(Unit unit)
        Indicates if this instance equals a unit.
        Specified by:
        equals in class Unit
        Parameters:
        unit - The unit.
        Returns:
        true if and only if this instance equals the unit.
      • hashCode

        public int hashCode()
        Returns the hash code of this instance. Object.hashCode() should be overridden whenever Object.equals(Object) is.
        Specified by:
        hashCode in class Unit
        Returns:
        The hash code of this instance.
      • getDerivedUnit

        public DerivedUnit getDerivedUnit()
        Description copied from class: Unit
        Returns the derived unit that underlies this unit.
        Specified by:
        getDerivedUnit in class Unit
        Returns:
        The derived unit that underlies this unit.

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.