public final class AddConverter extends AbstractConverter implements tec.uom.lib.common.function.ValueSupplier<Double>
This class represents a converter adding a constant offset to numeric values (double
based).
AbstractConverter.Pair
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) |
BigDecimal |
convert(BigDecimal value,
MathContext ctx) |
double |
convert(double value) |
boolean |
equals(Object obj) |
double |
getOffset()
Returns the offset value for this add converter.
|
Double |
getValue() |
int |
hashCode() |
AddConverter |
inverse() |
boolean |
isLinear() |
String |
toString() |
concatenate, convert, getConversionSteps, isIdentity
public AddConverter(double offset)
offset
- the offset value.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 BigDecimal convert(BigDecimal value, MathContext ctx) throws ArithmeticException
convert
in class AbstractConverter
ArithmeticException
public boolean equals(Object obj)
equals
in class AbstractConverter
public int hashCode()
hashCode
in class AbstractConverter
public boolean isLinear()
isLinear
in interface javax.measure.UnitConverter
Copyright © 2005–2019 Units of Measurement project. All rights reserved.