public final class AddConverter extends AbstractConverter implements tec.uom.lib.common.function.ValueSupplier<java.lang.Double>
This class represents a converter adding a constant offset to numeric values (double
based).
AbstractConverter.Pair
Modifier and Type | Field and Description |
---|---|
private double |
offset
Holds the offset.
|
private static long |
serialVersionUID |
IDENTITY, PI
Constructor and Description |
---|
AddConverter(double offset)
Creates an additive converter having the specified offset.
|
Modifier and Type | Method and Description |
---|---|
javax.measure.UnitConverter |
concatenate(javax.measure.UnitConverter converter) |
java.math.BigDecimal |
convert(java.math.BigDecimal value,
java.math.MathContext ctx) |
double |
convert(double value) |
boolean |
equals(java.lang.Object obj) |
double |
getOffset()
Returns the offset value for this add converter.
|
java.lang.Double |
getValue() |
int |
hashCode() |
AddConverter |
inverse() |
boolean |
isLinear() |
java.lang.String |
toString() |
concatenate, convert, getConversionSteps, isIdentity
private static final long serialVersionUID
private double offset
public AddConverter(double offset)
offset
- the offset value.java.lang.IllegalArgumentException
- if offset is 0.0
(would result in identity converter).public double getOffset()
public javax.measure.UnitConverter concatenate(javax.measure.UnitConverter converter)
concatenate
in interface javax.measure.UnitConverter
concatenate
in class AbstractConverter
public AddConverter inverse()
inverse
in interface javax.measure.UnitConverter
inverse
in class AbstractConverter
public double convert(double value)
convert
in interface javax.measure.UnitConverter
convert
in class AbstractConverter
public java.math.BigDecimal convert(java.math.BigDecimal value, java.math.MathContext ctx) throws java.lang.ArithmeticException
convert
in class AbstractConverter
java.lang.ArithmeticException
public final java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class AbstractConverter
public int hashCode()
hashCode
in class AbstractConverter
public boolean isLinear()
isLinear
in interface javax.measure.UnitConverter
public java.lang.Double getValue()
getValue
in interface tec.uom.lib.common.function.ValueSupplier<java.lang.Double>