Package tech.units.indriya.function
Class AbstractConverter.Pair
- java.lang.Object
-
- tech.units.indriya.function.AbstractConverter
-
- tech.units.indriya.function.AbstractConverter.Pair
-
- All Implemented Interfaces:
Serializable,Comparable<UnitConverter>,UnitConverter,tech.uom.lib.common.function.Converter<Number,Number>
- Enclosing class:
- AbstractConverter
public static final class AbstractConverter.Pair extends AbstractConverter implements Serializable
This class represents converters made up of two or more separate converters (in matrix notation[pair] = [left] x [right]).- 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 Pair(UnitConverter left, UnitConverter right)Creates a pair converter resulting from the combined transformation of the specified converters.
-
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 obj)protected NumberconvertWhenNotIdentity(Number value)Non-APIprotected List<? extends UnitConverter>createConversionSteps()booleanequals(Object obj)UnitConvertergetLeft()UnitConvertergetRight()inthashCode()AbstractConverter.PairinverseWhenNotIdentity()Non-APIbooleanisIdentity()booleanisLinear()Optional<Number>linearFactor()Even though transformations may be composed of addition and multiplication, the first derivative might just be a linear function.protected StringtransformationLiteral()Non-API-
Methods inherited from class tech.units.indriya.function.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, reduce, toString
-
-
-
-
Constructor Detail
-
Pair
public Pair(UnitConverter left, UnitConverter right)
Creates a pair converter resulting from the combined transformation of the specified converters.- Parameters:
left- the left converter, notnull.right- the right converter.- Throws:
IllegalArgumentException- if either the left or right converter are null
-
-
Method Detail
-
isLinear
public boolean isLinear()
- Specified by:
isLinearin interfaceUnitConverter
-
linearFactor
public Optional<Number> linearFactor()
Description copied from class:AbstractConverterEven though transformations may be composed of addition and multiplication, the first derivative might just be a linear function. This is strictly required for Quantities that are expressed with RELATIVE scope. Eg. Δ2°C or Δ2°F. Otherwise such deltas cannot be converted to ABSOLUTE scope without additional information.- Overrides:
linearFactorin classAbstractConverter- Returns:
- optionally the linear factor of this transformation's first derivative, based on whether this transformation allows for RELATIVE scaled Quantities
-
isIdentity
public boolean isIdentity()
- Specified by:
isIdentityin interfaceUnitConverter
-
createConversionSteps
protected List<? extends UnitConverter> createConversionSteps()
-
inverseWhenNotIdentity
public AbstractConverter.Pair 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
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractConverter
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractConverter
-
getLeft
public UnitConverter getLeft()
-
getRight
public UnitConverter getRight()
-
compareTo
public int compareTo(UnitConverter obj)
- Specified by:
compareToin interfaceComparable<UnitConverter>
-
transformationLiteral
protected 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:
-
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
-
-