Class AbstractConverter.Pair

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<javax.measure.UnitConverter>, javax.measure.UnitConverter
    Enclosing class:
    AbstractConverter

    public static final class AbstractConverter.Pair
    extends AbstractConverter
    implements java.io.Serializable
    This class represents converters made up of two or more separate converters (in matrix notation [pair] = [left] x [right]).
    See Also:
    Serialized Form
    • Field Detail

      • left

        private final javax.measure.UnitConverter left
        Holds the first converter.
      • right

        private final javax.measure.UnitConverter right
        Holds the second converter.
    • Constructor Detail

      • Pair

        public Pair​(javax.measure.UnitConverter left,
                    javax.measure.UnitConverter right)
        Creates a pair converter resulting from the combined transformation of the specified converters.
        Parameters:
        left - the left converter, not null.
        right - the right converter.
        Throws:
        java.lang.IllegalArgumentException - if either the left or right converter are null
    • Method Detail

      • isLinear

        public boolean isLinear()
        Specified by:
        isLinear in interface javax.measure.UnitConverter
      • isIdentity

        public boolean isIdentity()
        Specified by:
        isIdentity in interface javax.measure.UnitConverter
      • createConversionSteps

        protected java.util.List<? extends javax.measure.UnitConverter> createConversionSteps()
      • convertWhenNotIdentity

        public java.lang.Number convertWhenNotIdentity​(java.math.BigInteger value,
                                                       java.math.MathContext ctx)
        Description copied from class: AbstractConverter
        Non-API
        Overrides:
        convertWhenNotIdentity in class AbstractConverter
        Returns:
        transformed value (most likely a BigInteger or BigDecimal)
      • convertWhenNotIdentity

        public java.math.BigDecimal convertWhenNotIdentity​(java.math.BigDecimal value,
                                                           java.math.MathContext ctx)
        Description copied from class: AbstractConverter
        Non-API
        Specified by:
        convertWhenNotIdentity in class AbstractConverter
        Returns:
        transformed value
      • getLeft

        public javax.measure.UnitConverter getLeft()
      • getRight

        public javax.measure.UnitConverter getRight()
      • compareTo

        public int compareTo​(javax.measure.UnitConverter obj)
        Specified by:
        compareTo in interface java.lang.Comparable<javax.measure.UnitConverter>
      • transformationLiteral

        protected java.lang.String transformationLiteral()
        Description copied from class: AbstractConverter
        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.

        Specified by:
        transformationLiteral in class AbstractConverter
        Returns: