Class MultiplyConverter
java.lang.Object
tech.units.indriya.AbstractConverter
tech.units.indriya.function.MultiplyConverter
- All Implemented Interfaces:
Serializable, Comparable<javax.measure.UnitConverter>, javax.measure.UnitConverter, tech.uom.lib.common.function.DoubleFactorSupplier, tech.uom.lib.common.function.ValueSupplier<Double>
public final class MultiplyConverter
extends AbstractConverter
implements tech.uom.lib.common.function.ValueSupplier<Double>, tech.uom.lib.common.function.DoubleFactorSupplier
This class represents a converter multiplying numeric values by a constant
scaling factor (double based).
- Since:
- 1.0
- Version:
- 1.1, Apr 18, 2018
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class AbstractConverter
AbstractConverter.Pair -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final doubleHolds the scale factor.private static final longFields inherited from class AbstractConverter
conversionSteps, IDENTITY -
Constructor Summary
ConstructorsConstructorDescriptionMultiplyConverter(double factor) Creates a multiply converter with the specified scale factor. -
Method Summary
Modifier and TypeMethodDescriptionintcompareTo(javax.measure.UnitConverter o) doubleconvertWhenNotIdentity(double value) Non-APIconvertWhenNotIdentity(BigDecimal value, MathContext ctx) Non-APIbooleandoubleReturns the scale factor of this converter.getValue()inthashCode()Non-APIbooleanbooleanisLinear()protected booleanNon-API Guard forAbstractConverter.simpleCompose(AbstractConverter)static MultiplyConverterof(double factor) Creates a multiply converter with the specified scale factor.protected AbstractConverterNon-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)final StringNon-APIMethods inherited from class AbstractConverter
concatenate, convert, convert, convertWhenNotIdentity, getConversionSteps, inverse, of, toString
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
factor
private final double factorHolds the scale factor.
-
-
Constructor Details
-
MultiplyConverter
public MultiplyConverter(double factor) Creates a multiply converter with the specified scale factor.- Parameters:
factor- the scaling factor.
-
-
Method Details
-
of
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
Description copied from class:AbstractConverterNon-API Guard forAbstractConverter.simpleCompose(AbstractConverter)- Specified by:
isSimpleCompositionWithin classAbstractConverter- Parameters:
that-- Returns:
- whether or not a 'simple' composition of transformations is possible
-
simpleCompose
Description copied from class:AbstractConverterNon-API Guarded byAbstractConverter.isSimpleCompositionWith(AbstractConverter)- Overrides:
simpleComposein classAbstractConverter- Parameters:
that-- Returns:
- a new AbstractConverter that adds no additional conversion step
-
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- Parameters:
value-- Returns:
- transformed value
-
convertWhenNotIdentity
public BigDecimal convertWhenNotIdentity(BigDecimal value, MathContext ctx) throws ArithmeticException Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Parameters:
value-ctx-- Returns:
- transformed value
- Throws:
ArithmeticException
-
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
- Specified by:
equalsin classAbstractConverter
-
hashCode
public int hashCode()- Specified by:
hashCodein classAbstractConverter
-
isLinear
public boolean isLinear()- Specified by:
isLinearin interfacejavax.measure.UnitConverter
-
getValue
-
compareTo
public int compareTo(javax.measure.UnitConverter o) - Specified by:
compareToin interfaceComparable<javax.measure.UnitConverter>
-