Package tech.units.indriya
Class AbstractConverter.Identity
- java.lang.Object
-
- tech.units.indriya.AbstractConverter
-
- tech.units.indriya.AbstractConverter.Identity
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<javax.measure.UnitConverter>
,javax.measure.UnitConverter
- Enclosing class:
- AbstractConverter
private static final class AbstractConverter.Identity extends AbstractConverter
This class represents the identity converter (singleton).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tech.units.indriya.AbstractConverter
AbstractConverter.Pair
-
-
Field Summary
Fields Modifier and Type Field Description private static long
serialVersionUID
-
Fields inherited from class tech.units.indriya.AbstractConverter
conversionSteps, IDENTITY
-
-
Constructor Summary
Constructors Modifier Constructor Description private
Identity()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(javax.measure.UnitConverter o)
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-APIboolean
equals(java.lang.Object cvtr)
int
hashCode()
protected AbstractConverter
inverseWhenNotIdentity()
Non-APIboolean
isIdentity()
boolean
isLinear()
protected boolean
isSimpleCompositionWith(AbstractConverter that)
Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)
protected AbstractConverter
simpleCompose(AbstractConverter that)
Non-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)
protected java.lang.String
transformationLiteral()
Non-API-
Methods inherited from class tech.units.indriya.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, of, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
-
Method Detail
-
isIdentity
public boolean isIdentity()
-
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 cvtr)
- Specified by:
equals
in classAbstractConverter
-
hashCode
public int hashCode()
- Specified by:
hashCode
in classAbstractConverter
-
isLinear
public boolean isLinear()
-
compareTo
public int compareTo(javax.measure.UnitConverter o)
-
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
-
simpleCompose
protected AbstractConverter simpleCompose(AbstractConverter that)
Description copied from class:AbstractConverter
Non-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)
- Overrides:
simpleCompose
in classAbstractConverter
- Returns:
- a new AbstractConverter that adds no additional conversion step
-
inverseWhenNotIdentity
protected AbstractConverter 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:
-
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:
-
-