Package org.apfloat.calc
Class FunctionCalculatorImpl
java.lang.Object
org.apfloat.calc.AbstractCalculatorImpl
org.apfloat.calc.FunctionCalculatorImpl
- All Implemented Interfaces:
Serializable,CalculatorImpl
- Direct Known Subclasses:
ApfloatCalculatorImpl
Calculator implementation with function support.
Provides a mapping mechanism for functions.
- Version:
- 1.14.0
- Author:
- Mikko Tommila
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected classFunction taking a fixed number of arguments.protected static interfaceHandler for FixedFunction.protected static interfaceArbitrary function.protected static interfaceFunction implementations. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected FunctionCalculatorImpl.FixedFunctionfixedFunction(String name, int minArguments, int maxArguments, FunctionCalculatorImpl.FixedFunctionHandler handler) Factory method.protected FunctionCalculatorImpl.FixedFunctionfixedFunction(String name, int arguments, FunctionCalculatorImpl.FixedFunctionHandler handler) Factory method.Arbitrary function.protected abstract FunctionCalculatorImpl.FunctionsGet the function implementations.protected abstract NumberPromote a number to a more specific class.protected voidsetFunction(String name, FunctionCalculatorImpl.Function function) Define a function.Methods inherited from class org.apfloat.calc.AbstractCalculatorImpl
add, divide, doubleFactorial, factorial, getFormat, getInputPrecision, getVariable, mod, multiply, negate, pow, setFormat, setInputPrecision, setVariable, subtractMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apfloat.calc.CalculatorImpl
format, parseDecimal, parseInteger
-
Constructor Details
-
FunctionCalculatorImpl
protected FunctionCalculatorImpl()Default constructor.
-
-
Method Details
-
function
Description copied from interface:CalculatorImplArbitrary function.- Parameters:
name- Name of the function.arguments- Function arguments.- Returns:
- Function value.
- Throws:
ParseException- In case of invalid arguments.
-
fixedFunction
protected FunctionCalculatorImpl.FixedFunction fixedFunction(String name, int arguments, FunctionCalculatorImpl.FixedFunctionHandler handler) Factory method.- Parameters:
name- The function's name.arguments- The number of arguments that the function takes.handler- The handler of the function.- Returns:
- The function.
-
fixedFunction
protected FunctionCalculatorImpl.FixedFunction fixedFunction(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
Define a function.- Parameters:
name- The function name.function- The function.
-
getFunctions
Get the function implementations.- Parameters:
x- The number to use as the function argument.- Returns:
- The function implementations.
-
promote
-