Package tech.units.indriya.function
Class PowerOfIntConverter
- java.lang.Object
-
- tech.units.indriya.function.AbstractConverter
-
- tech.units.indriya.function.PowerOfIntConverter
-
- All Implemented Interfaces:
Serializable,Comparable<UnitConverter>,DoubleSupplier,UnitConverter,MultiplyConverter,tech.uom.lib.common.function.Converter<Number,Number>,tech.uom.lib.common.function.FactorSupplier<Number>,tech.uom.lib.common.function.IntBaseSupplier,tech.uom.lib.common.function.IntExponentSupplier,tech.uom.lib.common.function.ValueSupplier<Number>
public final class PowerOfIntConverter extends AbstractConverter implements MultiplyConverter, tech.uom.lib.common.function.IntBaseSupplier, tech.uom.lib.common.function.IntExponentSupplier
UnitConverter for numbers in base^exponent representation.- Since:
- 2.0
- Version:
- 2.0, Oct 8, 2020
- Author:
- Andi Huber, Werner Keil
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class tech.units.indriya.function.AbstractConverter
AbstractConverter.Pair
-
-
Field Summary
-
Fields inherited from class tech.units.indriya.function.AbstractConverter
conversionSteps, IDENTITY, UNIT_COMPOSITION_HANDLER
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPowerOfIntConverter(int base, int exponent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanReduceWith(AbstractConverter that)Non-API Guard forAbstractConverter.reduce(AbstractConverter)intcompareTo(UnitConverter o)protected NumberconvertWhenNotIdentity(Number value)Non-APIbooleanequals(Object obj)doublegetAsDouble()intgetBase()intgetExponent()NumbergetValue()inthashCode()AbstractConverterinverseWhenNotIdentity()Non-APIbooleanisIdentity()protected AbstractConverterreduce(AbstractConverter that)Non-API Guarded byAbstractConverter.canReduceWith(AbstractConverter)RationalConvertertoRationalConverter()StringtransformationLiteral()Non-API-
Methods inherited from class tech.units.indriya.function.AbstractConverter
concatenate, convert, convert, getConversionSteps, inverse, linearFactor, toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface tech.units.indriya.function.MultiplyConverter
getFactor, isLinear
-
Methods inherited from interface javax.measure.UnitConverter
concatenate, convert, convert, getConversionSteps, inverse
-
-
-
-
Constructor Detail
-
PowerOfIntConverter
protected PowerOfIntConverter(int base, int exponent)
-
-
Method Detail
-
getBase
public int getBase()
- Specified by:
getBasein interfacetech.uom.lib.common.function.IntBaseSupplier
-
getExponent
public int getExponent()
- Specified by:
getExponentin interfacetech.uom.lib.common.function.IntExponentSupplier
-
isIdentity
public boolean isIdentity()
- Specified by:
isIdentityin interfaceUnitConverter
-
canReduceWith
protected boolean canReduceWith(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guard forAbstractConverter.reduce(AbstractConverter)- Specified by:
canReduceWithin classAbstractConverter- Returns:
- whether or not a composition with given
thatis possible, such that no additional conversion steps are required, with respect to the steps already in place by this converter
-
reduce
protected AbstractConverter reduce(AbstractConverter that)
Description copied from class:AbstractConverterNon-API Guarded byAbstractConverter.canReduceWith(AbstractConverter)- Overrides:
reducein classAbstractConverter- Returns:
- a new AbstractConverter that adds no additional conversion steps, with respect to the steps already in place by this converter
-
inverseWhenNotIdentity
public AbstractConverter 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
protected Number convertWhenNotIdentity(Number value)
Description copied from class:AbstractConverterNon-API- Specified by:
convertWhenNotIdentityin classAbstractConverter- Returns:
- transformed value
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin classAbstractConverter
-
transformationLiteral
public final 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:
-
getValue
public Number getValue()
- Specified by:
getValuein interfacetech.uom.lib.common.function.ValueSupplier<Number>
-
getAsDouble
public double getAsDouble()
- Specified by:
getAsDoublein interfaceDoubleSupplier
-
compareTo
public int compareTo(UnitConverter o)
- Specified by:
compareToin interfaceComparable<UnitConverter>
-
hashCode
public int hashCode()
- Specified by:
hashCodein classAbstractConverter
-
toRationalConverter
public RationalConverter toRationalConverter()
-
-