|
Java Units API Build 2004-02-06 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object Converter
This class represents a converter of numeric values.
It is not required for sub-classes to be immutable (e.g. currency converter).
Field Summary | |
static Converter |
IDENTITY
Holds the identity converter. |
Constructor Summary | |
protected |
Converter()
Default constructor. |
Method Summary | |
Converter |
concatenate(Converter converter)
Concatenates this converter with another converter. |
abstract double |
convert(double x)
Converts a double value. |
abstract double |
derivative(double x)
Returns this converter derivative for the specified x value. |
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this converter. |
int |
hashCode()
Returns a hash code value for this converter. |
abstract Converter |
inverse()
Returns the inverse of this converter. |
abstract boolean |
isLinear()
Indicates if this converter is linear. |
Methods inherited from class Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final Converter IDENTITY
IDENTITY.convert(x) == x
).
Constructor Detail |
protected Converter()
Method Detail |
public abstract Converter inverse()
x
is a valid
value, then x == inverse().convert(convert(x))
to within
the accuracy of computer arithmetic.
public abstract double convert(double x) throws ConversionException
x
- the numeric value to convert.
ConversionException
- if an error occurs during conversion.public abstract double derivative(double x)
x
value. For linear converters, this method returns
a constant (the linear factor) for all x
values.
x
- the value for which the derivative is calculated.
public abstract boolean isLinear()
convert(u + v) == convert(u) + convert(v)
and
convert(r * u) == r * convert(u)
.
true
if this converter is linear;
false
otherwise.public boolean equals(Object obj)
obj
- the reference object with which to compare.
true
if this object is a linear converter and this
object is also a linear converter and both have same
derivatives; false
otherwise.public int hashCode()
equals(java.lang.Object)
public Converter concatenate(Converter converter)
converter
- the other converter.
|
Java Units API Build 2004-02-06 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Symbols, terms and definitions | JSR-108 project |