Package tech.units.indriya
Class AbstractConverter.Pair
java.lang.Object
tech.units.indriya.AbstractConverter
tech.units.indriya.AbstractConverter.Pair
- All Implemented Interfaces:
Serializable
,Comparable<javax.measure.UnitConverter>
,javax.measure.UnitConverter
- Enclosing class:
AbstractConverter
This class represents converters made up of two or more separate converters
(in matrix notation
[pair] = [left] x [right]
).- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class tech.units.indriya.AbstractConverter
AbstractConverter.Pair
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final javax.measure.UnitConverter
Holds the first converter.private final javax.measure.UnitConverter
Holds the second converter.private static final long
Fields inherited from class tech.units.indriya.AbstractConverter
conversionSteps, IDENTITY
-
Constructor Summary
ConstructorsConstructorDescriptionPair
(javax.measure.UnitConverter left, javax.measure.UnitConverter right) Creates a pair converter resulting from the combined transformation of the specified converters. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(javax.measure.UnitConverter obj) double
convertWhenNotIdentity
(double value) Non-APIconvertWhenNotIdentity
(BigDecimal value, MathContext ctx) Non-APIconvertWhenNotIdentity
(BigInteger value, MathContext ctx) Non-APIprotected List
<? extends javax.measure.UnitConverter> boolean
javax.measure.UnitConverter
getLeft()
javax.measure.UnitConverter
getRight()
int
hashCode()
Non-APIboolean
boolean
isLinear()
protected boolean
Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)
protected String
Non-APIMethods inherited from class tech.units.indriya.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, of, simpleCompose, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
left
private final javax.measure.UnitConverter leftHolds the first converter. -
right
private final javax.measure.UnitConverter rightHolds the second converter.
-
-
Constructor Details
-
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:
IllegalArgumentException
- if either the left or right converter are null
-
-
Method Details
-
isLinear
public boolean isLinear()- Specified by:
isLinear
in interfacejavax.measure.UnitConverter
-
isIdentity
public boolean isIdentity()- Specified by:
isIdentity
in interfacejavax.measure.UnitConverter
-
createConversionSteps
-
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
- Parameters:
value
-- Returns:
- transformed value
-
convertWhenNotIdentity
Description copied from class:AbstractConverter
Non-API- Overrides:
convertWhenNotIdentity
in classAbstractConverter
- Parameters:
value
-ctx
-- Returns:
- transformed value (most likely a BigInteger or BigDecimal)
-
convertWhenNotIdentity
Description copied from class:AbstractConverter
Non-API- Specified by:
convertWhenNotIdentity
in classAbstractConverter
- Parameters:
value
-ctx
-- Returns:
- transformed value
-
equals
- 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 interfaceComparable<javax.measure.UnitConverter>
-
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
Description copied from class:AbstractConverter
Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)
- Specified by:
isSimpleCompositionWith
in classAbstractConverter
- Parameters:
that
-- Returns:
- whether or not a 'simple' composition of transformations is possible
-