Package net.objecthunter.exp4j.function
Class Function
java.lang.Object
net.objecthunter.exp4j.function.Function
A class representing a Function which can be used in an expression
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract doubleapply(double... args) Method that does the actual calculation of the function value given the argumentsstatic char[]Deprecated.since 0.4.5 All unicode letters are allowed to be used in function names since 0.4.3.getName()Get the name of the FunctionintGet the number of arguments for this functionstatic booleanisValidFunctionName(String name)
-
Field Details
-
numArguments
protected final int numArguments
-
-
Constructor Details
-
Function
Create a new Function with a given name and number of arguments- Parameters:
name- the name of the FunctionnumArguments- the number of arguments the function takes
-
Function
Create a new Function with a given name that takes a single argument- Parameters:
name- the name of the Function
-
-
Method Details
-
getName
-
getNumArguments
public int getNumArguments()Get the number of arguments for this function- Returns:
- the number of arguments
-
apply
public abstract double apply(double... args) Method that does the actual calculation of the function value given the arguments- Parameters:
args- the set of arguments used for calculating the function- Returns:
- the result of the function evaluation
-
getAllowedFunctionCharacters
public static char[] getAllowedFunctionCharacters()Deprecated.since 0.4.5 All unicode letters are allowed to be used in function names since 0.4.3. This API Function can be safely ignored. Checks for function name validity can be done using Character.isLetter() et al.Get the set of characters which are allowed for use in Function names.- Returns:
- the set of characters allowed
-
isValidFunctionName
-