Class AbstractConverter

    • Field Detail

      • IDENTITY

        public static final AbstractConverter IDENTITY
        Default identity converter implementing AbstractConverter.

        Note: Checking whether a UnitConverter is an identity operator should be done with UnitConverter.isIdentity() rather than checking for object identity unitConverter == AbstractConverter.IDENTITY.

      • conversionSteps

        protected List<? extends javax.measure.UnitConverter> conversionSteps
        memorization for getConversionSteps
    • Constructor Detail

      • AbstractConverter

        protected AbstractConverter()
        DefaultQuantityFactory constructor.
    • Method Detail

      • transformationLiteral

        protected abstract String transformationLiteral()
        Non-API

        Returns a String describing the transformation that is represented by this converter. Contributes to converter's toString method. If null or empty toString output becomes simplified.

        Returns:
      • inverseWhenNotIdentity

        protected abstract AbstractConverter inverseWhenNotIdentity()
        Non-API

        Returns an AbstractConverter that represents the inverse transformation of this converter, for cases where the transformation is not the identity transformation.

        Returns:
      • canReduceWith

        protected abstract boolean canReduceWith​(AbstractConverter that)
        Non-API Guard for reduce(AbstractConverter)
        Parameters:
        that -
        Returns:
        whether or not a composition with given that is possible, such that no additional conversion steps are required, with respect to the steps already in place by this converter
      • concatenate

        public final javax.measure.UnitConverter concatenate​(javax.measure.UnitConverter converter)
        Specified by:
        concatenate in interface javax.measure.UnitConverter
      • getConversionSteps

        public final List<? extends javax.measure.UnitConverter> getConversionSteps()
        Specified by:
        getConversionSteps in interface javax.measure.UnitConverter
      • convert

        public final double convert​(double value)
        Specified by:
        convert in interface javax.measure.UnitConverter
      • linearFactor

        public Optional<Number> linearFactor()
        Even though transformations may be composed of addition and multiplication, the first derivative might just be a linear function. This is strictly required for Quantities that are expressed with RELATIVE scope. Eg. Δ2°C or Δ2°F. Otherwise such deltas cannot be converted to ABSOLUTE scope without additional information.
        Returns:
        optionally the linear factor of this transformation's first derivative, based on whether this transformation allows for RELATIVE scaled Quantities