Package tech.units.indriya.function
Class AddConverter
- java.lang.Object
-
- tech.units.indriya.function.AbstractConverter
-
- tech.units.indriya.function.AddConverter
-
- All Implemented Interfaces:
Serializable,Comparable<UnitConverter>,UnitConverter,tech.uom.lib.common.function.Converter<Number,Number>,tech.uom.lib.common.function.ValueSupplier<Number>
public final class AddConverter extends AbstractConverter implements tech.uom.lib.common.function.ValueSupplier<Number>
This class represents a converter adding a constant offset to numeric values (
doublebased).- Version:
- 1.2, Jun 21, 2019
- Author:
- Jean-Marie Dautelle, Werner Keil, Andi Huber
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tech.units.indriya.function.AbstractConverter
AbstractConverter.Pair
-
-
Field Summary
-
Fields inherited from class tech.units.indriya.function.AbstractConverter
conversionSteps, IDENTITY, UNIT_COMPOSITION_HANDLER
-
-
Constructor Summary
Constructors Constructor Description AddConverter(Number offset)Creates an additive converter having the specified offset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanReduceWith(AbstractConverter that)Non-API Guard forAbstractConverter.reduce(AbstractConverter)intcompareTo(UnitConverter o)protected NumberconvertWhenNotIdentity(Number value)Non-APIbooleanequals(Object obj)NumbergetOffset()Returns the offset value for this add converter.NumbergetValue()inthashCode()AddConverterinverseWhenNotIdentity()Non-APIbooleanisIdentity()booleanisLinear()protected AbstractConverterreduce(AbstractConverter that)Non-API Guarded byAbstractConverter.canReduceWith(AbstractConverter)StringtransformationLiteral()Non-API-
Methods inherited from class tech.units.indriya.function.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, linearFactor, toString
-
-
-
-
Constructor Detail
-
AddConverter
public AddConverter(Number offset)
Creates an additive converter having the specified offset.- Parameters:
offset- the offset value.
-
-
Method Detail
-
getOffset
public Number getOffset()
Returns the offset value for this add converter.- Returns:
- the offset value.
-
isIdentity
public boolean isIdentity()
- Specified by:
isIdentityin interfaceUnitConverter
-
canReduceWith
protected boolean canReduceWith(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guard forAbstractConverter.reduce(AbstractConverter)- Specified by:
canReduceWithin classAbstractConverter- Returns:
- whether or not a composition with given
thatis possible, such that no additional conversion steps are required, with respect to the steps already in place by this converter
-
reduce
protected AbstractConverter reduce(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guarded byAbstractConverter.canReduceWith(AbstractConverter)- Overrides:
reducein classAbstractConverter- Returns:
- a new AbstractConverter that adds no additional conversion steps, with respect to the steps already in place by this converter
-
inverseWhenNotIdentity
public AddConverter inverseWhenNotIdentity()
Description copied from class:AbstractConverterNon-APIReturns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.
- Specified by:
inverseWhenNotIdentityin classAbstractConverter- Returns:
-
convertWhenNotIdentity
protected Number convertWhenNotIdentity(Number value)
Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Returns:
- transformed value
-
transformationLiteral
public String transformationLiteral()
Description copied from class:AbstractConverterNon-APIReturns a String describing the transformation that is represented by this converter. Contributes to converter's
toStringmethod. If null or emptytoStringoutput becomes simplified.- Specified by:
transformationLiteralin classAbstractConverter- Returns:
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractConverter
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractConverter
-
isLinear
public boolean isLinear()
- Specified by:
isLinearin interfaceUnitConverter
-
getValue
public Number getValue()
- Specified by:
getValuein interfacetech.uom.lib.common.function.ValueSupplier<Number>
-
compareTo
public int compareTo(UnitConverter o)
- Specified by:
compareToin interfaceComparable<UnitConverter>
-
-