Package util

Class FunctionManager

java.lang.Object
util.FunctionManager

public class FunctionManager extends Object
  • Field Details

  • Constructor Details

    • FunctionManager

      public FunctionManager()
  • Method Details

    • contains

      public static boolean contains(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

      public static Function getFunction(String fName)
      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

      public static Function lookUp(String functionName)
      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

      public static Function add(String expression)
      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

      public static void add(Function f)
      Parameters:
      f - The Function object to add to this object.
    • load

      public static void load(Map<String,Function> functions)
      Loads the Function objects in this Map into the FUNCTIONS Map.
      Parameters:
      functions - A Map of Function objects.
    • load

      public static void load(Map<String,Function> functions, boolean clearFirst)
      Loads the Function objects in this Map into the FUNCTIONS Map.
      Parameters:
      functions - A Map of Function objects.
      clearFirst - If true, then the FUNCTIONS is cleared first before new content is loaded into it.
    • delete

      public static void delete(String fName)
      Removes a Function object from this FunctionManager.
    • update

      public static void update(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

      public static final ArrayList<Function> getDefinedFunctions()
      Returns:
      An ArrayList of 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.