Top Description Methods
tech.units.indriya.function

public Interface MultiplyConverter

extends UnitConverter, Converter<Number, Number>, ValueSupplier<Number>, FactorSupplier<Number>, DoubleSupplier, Comparable<UnitConverter>
Known Direct Implementers
tech.units.indriya.function.PowerOfIntConverter, tech.units.indriya.function.PowerOfPiConverter, tech.units.indriya.function.RationalConverter, tech.units.indriya.function.DoubleMultiplyConverter, tech.units.indriya.function.IdentityMultiplyConverter
Imports
java.math.BigDecimal, .BigInteger, java.util.function.DoubleSupplier, javax.measure.Prefix, .UnitConverter, tech.units.indriya.spi.NumberSystem, tech.uom.lib.common.function.Converter, .FactorSupplier, .ValueSupplier

This class represents a converter multiplying numeric values by a constant scaling factor represented by the Number type.

Authors
Jean-Marie Dautelle, Werner Keil, Andi Huber
Since
1.0
Version
2.7, October 8, 2020

Method Summary

Modifier and TypeMethod and Description
public default Number

Returns:

the scale factor.
getFactor
()

Implements tech.uom.lib.common.function.FactorSupplier.getFactor.

Returns the scale factor of this converter.

public static MultiplyConverter
identity()

Returns a MultiplyConverter that acts as a 'pass-through'.

public default boolean
isLinear()

Implements javax.measure.UnitConverter.isLinear.

Indicates whether this converter represents a (one-dimensional) linear transformation, that is a linear map (wikipedia) from a one-dimensional vector space (a scalar) to a one-dimensional vector space.

public static MultiplyConverter
of(Number factor)

Creates a MultiplyConverter with the specified constant factor.

public static MultiplyConverter

Returns:

a new MultiplyConverter.
of
(double
the double factor.
factor
)

Creates a MultiplyConverter with the specified constant factor.

public static MultiplyConverter

Returns:

a new MultiplyConverter.
ofExponent
(int
the base.
base
,
int
the exponent.
exponent
)

Creates a MultiplyConverter with the specified base and exponent.

public static MultiplyConverter

Returns:

a new MultiplyConverter.
ofPiExponent
(int
the exponent for the factor π^exponent.
exponent
)

Creates a MultiplyConverter with the specified exponent of Pi.

public static MultiplyConverter

Returns:

a new MultiplyConverter.
ofPrefix
(Prefix
the prefix for the factor.
prefix
)

Creates a MultiplyConverter with the specified Prefix.

public static MultiplyConverter
public static MultiplyConverter
ofRational(long dividend, long divisor)

Creates a MultiplyConverter with the specified rational factor made up of dividend and divisor

public static MultiplyConverter
ofRational(BigInteger dividend, BigInteger divisor)

Creates a MultiplyConverter with the specified rational factor made up of dividend and divisor

public static MultiplyConverter
ofTenExponent(int
the exponent for the factor 10^exponent.
exponent
)

Creates a MultiplyConverter with base 10 and an exponent.

Inherited from java.lang.Comparable:
compareTo
Inherited from java.util.function.DoubleSupplier:
getAsDouble
Inherited from javax.measure.UnitConverter:
concatenateconvertconvertgetConversionStepsinverseisIdentity
Inherited from tech.uom.lib.common.function.Converter:
convert
Inherited from tech.uom.lib.common.function.ValueSupplier:
getValue

Method Detail

getFactorback to summary
public default Number getFactor()

Implements tech.uom.lib.common.function.FactorSupplier.getFactor.

Returns the scale factor of this converter.

Returns:Number

the scale factor.

identityback to summary
public static MultiplyConverter identity()

Returns a MultiplyConverter that acts as a 'pass-through'.

isLinearback to summary
public default boolean isLinear()

Implements javax.measure.UnitConverter.isLinear.

Doc from javax.measure.UnitConverter.isLinear.

Indicates whether this converter represents a (one-dimensional) linear transformation, that is a linear map (wikipedia) from a one-dimensional vector space (a scalar) to a one-dimensional vector space. Typically from 'R' to 'R', with 'R' the real numbers.

Given such a 'linear' converter 'A', let 'u', 'v' and 'r' be arbitrary numbers, then the following must hold by definition:

  • A(u + v) == A(u) + A(v)
  • A(r * u) == r * A(u)

Given a second 'linear' converter 'B', commutativity of composition follows by above definition:

  • (A o B) (u) == (B o A) (u)
In other words, two 'linear' converters do have the property that A(B(u)) == B(A(u)), meaning for 'A' and 'B' the order of their composition does not matter. Expressed as Java code:

A.concatenate(B).convert(u) == B.concatenate(A).convert(u)

Note: For composing UnitConverters see also UnitConverter#concatenate(UnitConverter).
Returns:boolean

true if this converter represents a linear transformation; false otherwise.

Annotations
@Override
ofback to summary
public static MultiplyConverter of(Number factor)

Creates a MultiplyConverter with the specified constant factor.

ofback to summary
public static MultiplyConverter of(double factor)

Creates a MultiplyConverter with the specified constant factor.

Parameters
factor:double

the double factor.

Returns:MultiplyConverter

a new MultiplyConverter.

ofExponentback to summary
public static MultiplyConverter ofExponent(int base, int exponent)

Creates a MultiplyConverter with the specified base and exponent.

Parameters
base:int

the base.

exponent:int

the exponent.

Returns:MultiplyConverter

a new MultiplyConverter.

ofPiExponentback to summary
public static MultiplyConverter ofPiExponent(int exponent)

Creates a MultiplyConverter with the specified exponent of Pi.

Parameters
exponent:int

the exponent for the factor π^exponent.

Returns:MultiplyConverter

a new MultiplyConverter.

ofPrefixback to summary
public static MultiplyConverter ofPrefix(Prefix prefix)

Creates a MultiplyConverter with the specified Prefix.

Parameters
prefix:Prefix

the prefix for the factor.

Returns:MultiplyConverter

a new MultiplyConverter.

ofRationalback to summary
public static MultiplyConverter ofRational(RationalNumber factor)
ofRationalback to summary
public static MultiplyConverter ofRational(long dividend, long divisor)

Creates a MultiplyConverter with the specified rational factor made up of dividend and divisor

ofRationalback to summary
public static MultiplyConverter ofRational(BigInteger dividend, BigInteger divisor)

Creates a MultiplyConverter with the specified rational factor made up of dividend and divisor

ofTenExponentback to summary
public static MultiplyConverter ofTenExponent(int exponent)

Creates a MultiplyConverter with base 10 and an exponent.

Parameters
exponent:int

the exponent for the factor 10^exponent.