JADE v6.1

javax.units
Class LogConverter

java.lang.Object
  extended byjavax.units.Converter
      extended byjavax.units.LogConverter
All Implemented Interfaces:
java.io.Serializable

public final class LogConverter
extends Converter

This class represents a logarithmic converter. Such converter is typically used to create logarithmic unit. For example:

     Unit BEL = TransformedUnit.getInstance(
          Unit.ONE, new LogConverter(10).inverse());

Instances of this class are immutable.

Version:
6.0, June 12, 2004
Author:
Jean-Marie Dautelle
See Also:
Serialized Form

Field Summary
 
Fields inherited from class javax.units.Converter
IDENTITY
 
Constructor Summary
LogConverter(double base)
          Creates a logarithmic converter having the specified base.
 
Method Summary
 double convert(double x)
          Converts a double value.
 double derivative(double x)
          Returns this converter derivative for the specified x value.
 boolean equals(java.lang.Object obj)
          Indicates whether some other object is "equal to" this converter.
 double getBase()
          Returns the logarithmic base of this converter.
 int hashCode()
          Returns a hash code value for this converter.
 Converter inverse()
          Returns the inverse of this converter.
 boolean isLinear()
          Indicates if this converter is linear.
 
Methods inherited from class javax.units.Converter
concatenate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogConverter

public LogConverter(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

getBase

public double getBase()
Returns the logarithmic base of this converter.

Returns:
the logarithmic base (e.g. Math.E for the Natural Logarithm).

inverse

public Converter inverse()
Description copied from class: Converter
Returns the inverse of this converter. If x is a valid value, then x == inverse().convert(convert(x)) to within the accuracy of computer arithmetic.

Specified by:
inverse in class Converter
Returns:
the inverse of this converter.

convert

public double convert(double x)
Description copied from class: Converter
Converts a double value.

Specified by:
convert in class Converter
Parameters:
x - the numeric value to convert.
Returns:
the converted numeric value.

derivative

public double derivative(double x)
Description copied from class: Converter
Returns this converter derivative for the specified x value. For linear converters, this method returns a constant (the linear factor) for all x values.

Specified by:
derivative in class Converter
Parameters:
x - the value for which the derivative is calculated.
Returns:
the derivative for the specified value.

isLinear

public boolean isLinear()
Description copied from class: Converter
Indicates if this converter is linear. A converter is linear if convert(u + v) == convert(u) + convert(v) and convert(r * u) == r * convert(u).

Specified by:
isLinear in class Converter
Returns:
true if this converter is linear; false otherwise.

equals

public boolean equals(java.lang.Object obj)
Description copied from class: Converter
Indicates whether some other object is "equal to" this converter.

Overrides:
equals in class Converter
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is a linear converter and this object is also a linear converter and both have same derivatives; false otherwise.

hashCode

public int hashCode()
Description copied from class: Converter
Returns a hash code value for this converter. Equals object have equal hash codes.

Overrides:
hashCode in class Converter
Returns:
this converter hash code value.
See Also:
Converter.equals(java.lang.Object)

JADE v6.1

Copyright © 2004 Jean-Marie Dautelle.