Package tech.units.indriya
Class AbstractConverter.Pair
- java.lang.Object
-
- tech.units.indriya.AbstractConverter
-
- tech.units.indriya.AbstractConverter.Pair
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<javax.measure.UnitConverter>
,javax.measure.UnitConverter
- Enclosing class:
- AbstractConverter
public static final class AbstractConverter.Pair extends AbstractConverter implements java.io.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.AbstractConverter
AbstractConverter.Pair
-
-
Field Summary
Fields Modifier and Type Field Description private javax.measure.UnitConverter
left
Holds the first converter.private javax.measure.UnitConverter
right
Holds the second converter.private static long
serialVersionUID
-
Fields inherited from class tech.units.indriya.AbstractConverter
conversionSteps, IDENTITY
-
-
Constructor Summary
Constructors Constructor Description Pair(javax.measure.UnitConverter left, javax.measure.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 int
compareTo(javax.measure.UnitConverter obj)
double
convertWhenNotIdentity(double value)
Non-APIjava.math.BigDecimal
convertWhenNotIdentity(java.math.BigDecimal value, java.math.MathContext ctx)
Non-APIjava.lang.Number
convertWhenNotIdentity(java.math.BigInteger value, java.math.MathContext ctx)
Non-APIprotected java.util.List<? extends javax.measure.UnitConverter>
createConversionSteps()
boolean
equals(java.lang.Object obj)
javax.measure.UnitConverter
getLeft()
javax.measure.UnitConverter
getRight()
int
hashCode()
AbstractConverter.Pair
inverseWhenNotIdentity()
Non-APIboolean
isIdentity()
boolean
isLinear()
protected boolean
isSimpleCompositionWith(AbstractConverter that)
Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)
protected java.lang.String
transformationLiteral()
Non-API-
Methods inherited from class tech.units.indriya.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, of, simpleCompose, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
left
private final javax.measure.UnitConverter left
Holds the first converter.
-
right
private final javax.measure.UnitConverter right
Holds the second converter.
-
-
Constructor Detail
-
Pair
public Pair(javax.measure.UnitConverter left, javax.measure.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:
java.lang.IllegalArgumentException
- if either the left or right converter are null
-
-
Method Detail
-
isLinear
public boolean isLinear()
- Specified by:
isLinear
in interfacejavax.measure.UnitConverter
-
isIdentity
public boolean isIdentity()
- Specified by:
isIdentity
in interfacejavax.measure.UnitConverter
-
createConversionSteps
protected java.util.List<? extends javax.measure.UnitConverter> createConversionSteps()
-
inverseWhenNotIdentity
public AbstractConverter.Pair inverseWhenNotIdentity()
Description copied from class:AbstractConverter
Non-APIReturns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.
- Specified by:
inverseWhenNotIdentity
in classAbstractConverter
- Returns:
-
convertWhenNotIdentity
public double convertWhenNotIdentity(double value)
Description copied from class:AbstractConverter
Non-API- Specified by:
convertWhenNotIdentity
in classAbstractConverter
- Returns:
- transformed value
-
convertWhenNotIdentity
public java.lang.Number convertWhenNotIdentity(java.math.BigInteger value, java.math.MathContext ctx)
Description copied from class:AbstractConverter
Non-API- Overrides:
convertWhenNotIdentity
in classAbstractConverter
- Returns:
- transformed value (most likely a BigInteger or BigDecimal)
-
convertWhenNotIdentity
public java.math.BigDecimal convertWhenNotIdentity(java.math.BigDecimal value, java.math.MathContext ctx)
Description copied from class:AbstractConverter
Non-API- Specified by:
convertWhenNotIdentity
in classAbstractConverter
- Returns:
- transformed value
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in classAbstractConverter
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classAbstractConverter
-
getLeft
public javax.measure.UnitConverter getLeft()
-
getRight
public javax.measure.UnitConverter getRight()
-
compareTo
public int compareTo(javax.measure.UnitConverter obj)
- Specified by:
compareTo
in interfacejava.lang.Comparable<javax.measure.UnitConverter>
-
transformationLiteral
protected java.lang.String transformationLiteral()
Description copied from class:AbstractConverter
Non-APIReturns a String describing the transformation that is represented by this converter. Contributes to converter's
toString
method. If null or emptytoString
output becomes simplified.- Specified by:
transformationLiteral
in classAbstractConverter
- Returns:
-
isSimpleCompositionWith
protected boolean isSimpleCompositionWith(AbstractConverter that)
Description copied from class:AbstractConverter
Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)
- Specified by:
isSimpleCompositionWith
in classAbstractConverter
- Returns:
- whether or not a 'simple' composition of transformations is possible
-
-