Maths
Interface FunctionParser


public interface FunctionParser

Interface for a function parser. That is a class that parses a string of the form "function[double1,double2,...]" and return a numerical function of it. MathsParse implements some common functions used in phylogenetics and is a useful example of how to implement this class.

Version:
1.0

Method Summary
 double evaluate(java.lang.String function, java.lang.Double[] variables)
          A function that evaluates all the functions implemented
 java.util.List<java.lang.String> implemented()
          Returns a list of function names that this class can calculate
 

Method Detail

evaluate

double evaluate(java.lang.String function,
                java.lang.Double[] variables)
                throws WrongNumberOfVariables,
                       NoSuchFunction
A function that evaluates all the functions implemented

Parameters:
function - The function name
variables - An array of inputs in the order they appear in the function call
Returns:
The numerical result of the function
Throws:
WrongNumberOfVariables - Thrown when the incorrect number of imputs to that function is passed.
NoSuchFunction - Thrown when the class can't parse a function of that name

implemented

java.util.List<java.lang.String> implemented()
Returns a list of function names that this class can calculate

Returns:
A list of functions the class implements