Constructor and Description |
---|
BinaryFunction() |
Modifier and Type | Method and Description |
---|---|
protected abstract double |
eval(double a,
double b)
Performs the computation of the binary function
|
double |
eval(List<Expression> args)
Executes the function with the given arguments.
|
int |
getNumberOfArguments()
Returns the number of expected arguments.
|
boolean |
isNaturalFunction()
A natural function returns the same output for the same input.
|
public int getNumberOfArguments()
Function
If the function is called with a different number of arguments, an error will be created
In order to support functions with a variable number of arguments, a negative number can be returned. This will essentially disable the check.
getNumberOfArguments
in interface Function
public double eval(List<Expression> args)
Function
The arguments need to be evaluated first. This is not done externally to permit functions to perform lazy evaluations.
protected abstract double eval(double a, double b)
a
- the first argument of the functionb
- the second argument of the functionpublic boolean isNaturalFunction()
Function
All classical mathematical functions are "natural". A function which reads user input is not natural, as the function might return different results depending on the users input
isNaturalFunction
in interface Function
Copyright © 2020. All rights reserved.