Package util
Class FunctionManager
java.lang.Object
util.FunctionManager
public class FunctionManager
extends java.lang.Object
- Author:
- JIBOYE OLUWAGBEMIRO OLAOLUWA
-
Field Summary
-
Constructor Summary
Constructors Constructor Description FunctionManager() -
Method Summary
Modifier and Type Method Description static Functionadd(java.lang.String expression)Adds a Function object to this FunctionManager.static voidadd(Function f)static voidclearAnonymousFunctions()Deletes all anonymous functionsstatic booleancontains(java.lang.String fName)static intcountAnonymousFunctions()static voiddelete(java.lang.String fName)Removes a Function object from this FunctionManager.static java.util.ArrayList<Function>getDefinedFunctions()static FunctiongetFunction(java.lang.String fName)static voidinitializeFunctionVars()Registers the parameters of all registered functions as Variables on the Variable Registry.static voidload(java.util.Map<java.lang.String,Function> functions)static voidload(java.util.Map<java.lang.String,Function> functions, boolean clearFirst)static FunctionlookUp(java.lang.String functionName)Attempts to retrieve a Function object from a FunctionManager based on its name.static voidupdate()Saves stored functions and: updates the client UIs that use this manager.static voidupdate(java.lang.String expression)Updates a Function object in this FunctionManager.
-
Field Details
-
Constructor Details
-
FunctionManager
public FunctionManager()
-
-
Method Details
-
contains
public static boolean contains(java.lang.String fName)- Parameters:
fName- The name of the dependent variable of the function or the full name of the function which is a combination of the name of its dependent variable and its independent variables enclosed in circular parentheses. e.g in y = x^3, either y or y(x) may be supplied.- Returns:
- true if a Function exists by the name supplied.
-
getFunction
- Parameters:
fName- The name of the dependent variable of the function.- Returns:
- the Function object that has the name supplied if it exists. If no such Function object exists, then it returns null.
-
lookUp
Attempts to retrieve a Function object from a FunctionManager based on its name.- Parameters:
functionName- The name of the Function object.- Returns:
- the Function object that has that name or null if the Function is not found.
-
add
Adds a Function object to this FunctionManager.- Parameters:
expression- The expression that creates the Function to add. The form is:F=@(x,y,z,...)mathexpr. e.g y=@(x)3x-x^2; Functions take precedence over variables.. so if a function called sin_func is created and there exists a variable with that name, the system discards that variable
-
add
- Parameters:
f- The Function object to add to this object.
-
load
- Parameters:
functions- AMapofFunctionobjects.
-
load
-
delete
public static void delete(java.lang.String fName)Removes a Function object from this FunctionManager. -
update
public static void update(java.lang.String expression)Updates a Function object in this FunctionManager. -
clearAnonymousFunctions
public static void clearAnonymousFunctions()Deletes all anonymous functions -
countAnonymousFunctions
public static int countAnonymousFunctions()- Returns:
- the number of anonymous functions in the FunctionManager.
-
getDefinedFunctions
- Returns:
- An
ArrayListof all non-anonymous functions.
-
update
public static void update()Saves stored functions and: updates the client UIs that use this manager. -
initializeFunctionVars
public static void initializeFunctionVars()Registers the parameters of all registered functions as Variables on the Variable Registry.
-