Interface CalculatorImpl

    • Method Detail

      • function

        Number function​(String name,
                        List<Number> arguments)
                 throws ParseException
        Arbitrary function.
        Parameters:
        name - Name of the function.
        arguments - Function arguments.
        Returns:
        Function value.
        Throws:
        ParseException - In case of invalid arguments.
      • parseInteger

        Number parseInteger​(String value)
                     throws ParseException
        Parse a string to an integer number.
        Parameters:
        value - The string to parse.
        Returns:
        The number.
        Throws:
        ParseException - In case of invalid number.
      • parseDecimal

        Number parseDecimal​(String value)
                     throws ParseException
        Parse a string to a floating-point number.
        Parameters:
        value - The string to parse.
        Returns:
        The number.
        Throws:
        ParseException - In case of invalid number.
      • getVariable

        Number getVariable​(String name)
                    throws ParseException
        Get a variable.
        Parameters:
        name - Name of the variable.
        Returns:
        Value of the variable, or null if the variable is not defined.
        Throws:
        ParseException - In case of invalid argument.
      • setVariable

        void setVariable​(String name,
                         Number value)
                  throws ParseException
        Set a variable.
        Parameters:
        name - Name of the variable.
        value - Value of the variable.
        Throws:
        ParseException - In case of invalid arguments.
      • setFormat

        void setFormat​(boolean pretty)
        Set the formatting option.
        Parameters:
        pretty - If a fixed-point or a floating-point notation should be used.
      • setInputPrecision

        void setInputPrecision​(Long inputPrecision)
        Set a fixed input precision.
        Parameters:
        inputPrecision - The precision if a fixed precision is used or null for arbitrary precision.
      • format

        String format​(Number x)
        Convert a number to a String. The current formatting option is used.
        Parameters:
        x - The number.
        Returns:
        The String.