Package tech.units.indriya.function
Class MultiplyConverter
- java.lang.Object
-
- tech.units.indriya.AbstractConverter
-
- tech.units.indriya.function.MultiplyConverter
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<javax.measure.UnitConverter>,javax.measure.UnitConverter,tech.uom.lib.common.function.DoubleFactorSupplier,tech.uom.lib.common.function.ValueSupplier<java.lang.Double>
public final class MultiplyConverter extends AbstractConverter implements tech.uom.lib.common.function.ValueSupplier<java.lang.Double>, tech.uom.lib.common.function.DoubleFactorSupplier
This class represents a converter multiplying numeric values by a constant scaling factor (
doublebased).- Since:
- 1.0
- Version:
- 1.1, Apr 18, 2018
- 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 doublefactorHolds the scale factor.private static longserialVersionUID-
Fields inherited from class tech.units.indriya.AbstractConverter
conversionSteps, IDENTITY
-
-
Constructor Summary
Constructors Constructor Description MultiplyConverter(double factor)Creates a multiply converter with the specified scale factor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(javax.measure.UnitConverter o)doubleconvertWhenNotIdentity(double value)Non-APIjava.math.BigDecimalconvertWhenNotIdentity(java.math.BigDecimal value, java.math.MathContext ctx)Non-APIbooleanequals(java.lang.Object obj)doublegetFactor()Returns the scale factor of this converter.java.lang.DoublegetValue()inthashCode()MultiplyConverterinverseWhenNotIdentity()Non-APIbooleanisIdentity()booleanisLinear()protected booleanisSimpleCompositionWith(AbstractConverter that)Non-API Guard forAbstractConverter.simpleCompose(AbstractConverter)static MultiplyConverterof(double factor)Creates a multiply converter with the specified scale factor.protected AbstractConvertersimpleCompose(AbstractConverter that)Non-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)java.lang.StringtransformationLiteral()Non-API-
Methods inherited from class tech.units.indriya.AbstractConverter
concatenate, convert, convert, convertWhenNotIdentity, getConversionSteps, inverse, of, toString
-
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
factor
private final double factor
Holds the scale factor.
-
-
Method Detail
-
of
public static MultiplyConverter of(double factor)
Creates a multiply converter with the specified scale factor.- Parameters:
factor- the scaling factor.
-
getFactor
public double getFactor()
Returns the scale factor of this converter.- Specified by:
getFactorin interfacetech.uom.lib.common.function.DoubleFactorSupplier- Returns:
- the scale factor.
-
isIdentity
public boolean isIdentity()
- Specified by:
isIdentityin interfacejavax.measure.UnitConverter
-
isSimpleCompositionWith
protected boolean isSimpleCompositionWith(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guard forAbstractConverter.simpleCompose(AbstractConverter)- Specified by:
isSimpleCompositionWithin classAbstractConverter- Returns:
- whether or not a 'simple' composition of transformations is possible
-
simpleCompose
protected AbstractConverter simpleCompose(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)- Overrides:
simpleComposein classAbstractConverter- Returns:
- a new AbstractConverter that adds no additional conversion step
-
inverseWhenNotIdentity
public MultiplyConverter 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
public double convertWhenNotIdentity(double value)
Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Returns:
- transformed value
-
convertWhenNotIdentity
public java.math.BigDecimal convertWhenNotIdentity(java.math.BigDecimal value, java.math.MathContext ctx) throws java.lang.ArithmeticExceptionDescription copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Returns:
- transformed value
- Throws:
java.lang.ArithmeticException
-
transformationLiteral
public final java.lang.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(java.lang.Object obj)
- Specified by:
equalsin classAbstractConverter
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractConverter
-
isLinear
public boolean isLinear()
- Specified by:
isLinearin interfacejavax.measure.UnitConverter
-
getValue
public java.lang.Double getValue()
- Specified by:
getValuein interfacetech.uom.lib.common.function.ValueSupplier<java.lang.Double>
-
compareTo
public int compareTo(javax.measure.UnitConverter o)
- Specified by:
compareToin interfacejava.lang.Comparable<javax.measure.UnitConverter>
-
-