Class Conversion

    • Field Detail

      • conversions

        protected final Conversion[] conversions
        Conversions, if any, which are passed into the constructor of this instance. If none are passed, then the implementation has a short-cut form, e.g. taking an Integer rather than an Conversion.Int.
    • Constructor Detail

      • Conversion

        public Conversion​(Conversion... conversions)
        Primary constructor for a Conversion object. No processing happens during constructor. Instead, the convert(double) method will handle descending through the recursive structure.
        Parameters:
        conversions - can be empty.
    • Method Detail

      • convert

        public abstract java.math.BigDecimal convert​(double original)
        Primary operator for Conversion instances.
        Parameters:
        original - A unit value which is to be processed through the tree-like representation of this equation. Only Conversion.Sym objects will actually use the "original" value.
        Returns:
        a BigDecimal result from the calculation. If this value maps to Double.NEGATIVE_INFINITY or Double.POSITIVE_INFINITY, then a BigResult exception should be thrown before returning to clients.