Class FunctionCalculatorImpl

    • Constructor Detail

      • FunctionCalculatorImpl

        protected FunctionCalculatorImpl()
        Default constructor.
    • Method Detail

      • function

        public java.lang.Number function​(java.lang.String name,
                                         java.util.List<java.lang.Number> arguments)
                                  throws ParseException
        Description copied from interface: CalculatorImpl
        Arbitrary function.
        Parameters:
        name - Name of the function.
        arguments - Function arguments.
        Returns:
        Function value.
        Throws:
        ParseException - In case of invalid arguments.
      • argumentOrInputPrecision

        private java.lang.Number argumentOrInputPrecision​(java.util.List<java.lang.Number> arguments)
      • fixedFunction

        protected FunctionCalculatorImpl.FixedFunction fixedFunction​(java.lang.String name,
                                                                     int minArguments,
                                                                     int maxArguments,
                                                                     FunctionCalculatorImpl.FixedFunctionHandler handler)
        Factory method.
        Parameters:
        name - The function's name.
        minArguments - The minimum number of arguments that the function takes.
        maxArguments - The maximum number of arguments that the function takes.
        handler - The handler of the function.
        Returns:
        The function.
      • setFunction

        protected void setFunction​(java.lang.String name,
                                   FunctionCalculatorImpl.Function function)
        Define a function.
        Parameters:
        name - The function name.
        function - The function.
      • getFunctions

        protected abstract FunctionCalculatorImpl.Functions getFunctions​(java.lang.Number x)
        Get the function implementations.
        Parameters:
        x - The number to use as the function argument.
        Returns:
        The function implementations.
      • promote

        protected abstract java.lang.Number promote​(java.lang.Number x)
        Promote a number to a more specific class.
        Parameters:
        x - The argument.
        Returns:
        The argument, possibly converted to a more specific subclass.