Public Member Functions | |
FuncMap () | |
FuncMap (boolean caseSensitive) | |
void | loadDefaultFunctions () |
Adds the mappings for many common functions. | |
Function | getFunction (String funcName, int numParam) |
Returns a function based on the name and the specified number of parameters. | |
void | setFunction (String funcName, Function f) |
Assigns the name to map to the specified function. | |
boolean | isCaseSensitive () |
Returns true if the case of the function names is considered. | |
String[] | getFunctionNames () |
Returns an array of exact length of the function names stored in this map. | |
Function[] | getFunctions () |
Returns an array of exact length of the functions stored in this map. | |
void | remove (String funcName) |
Removes the function-name and the associated function from the map. | |
Private Attributes | |
String[] | name = new String[50] |
Function[] | func = new Function[50] |
int | numFunc = 0 |
boolean | caseSensitive = false |
FuncMap maps a name to a function. A FuncMap is used in the eval method of an Expression object. This class can be used as the default function-map. The loadDefaultFunctions() method can be used to take advantage of the many already implemented functions (see below).
During the evaluation of an expression, if a function is not supported then a RuntimeException is thrown.
Default functions:
Note: Case sensitivity can only be specified in the constructor (for consistency). When case sensitivity is false, the String.equalsIgnoreCase method is used. When case sensitivity is true, the String.equals method is used. The matching does not include the parenthesis. For example, when case sensitivity is false and the default functions have been loaded, then "RaNd", "rand", and "RAND" all map to the RandFunction(). By default, case sensitivity is false.
Definition at line 81 of file FuncMap.java.
com.graphbuilder.math.FuncMap.FuncMap | ( | ) |
Definition at line 88 of file FuncMap.java.
com.graphbuilder.math.FuncMap.FuncMap | ( | boolean | caseSensitive | ) |
Definition at line 90 of file FuncMap.java.
Function com.graphbuilder.math.FuncMap.getFunction | ( | String | funcName, | |
int | numParam | |||
) |
Returns a function based on the name and the specified number of parameters.
RuntimeException | If no supporting function can be found. |
Definition at line 152 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.caseSensitive, com.graphbuilder.math.FuncMap.func, com.graphbuilder.math.FuncMap.name, and com.graphbuilder.math.FuncMap.numFunc.
Referenced by com.graphbuilder.math.FuncNode.eval().
String [] com.graphbuilder.math.FuncMap.getFunctionNames | ( | ) |
Returns an array of exact length of the function names stored in this map.
Definition at line 208 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.name, and com.graphbuilder.math.FuncMap.numFunc.
Referenced by edu.rice.cs.hpc.viewer.metric.ExtDerivedMetricDlg.createDialogArea().
Function [] com.graphbuilder.math.FuncMap.getFunctions | ( | ) |
Returns an array of exact length of the functions stored in this map.
The returned array corresponds to the order of the names returned by getFunctionNames.
Definition at line 221 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.func, and com.graphbuilder.math.FuncMap.numFunc.
Referenced by edu.rice.cs.hpc.viewer.metric.ExtDerivedMetricDlg.createDialogArea(), and edu.rice.cs.hpc.data.experiment.metric.MetricVarMap.main().
boolean com.graphbuilder.math.FuncMap.isCaseSensitive | ( | ) |
Returns true if the case of the function names is considered.
Definition at line 201 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.caseSensitive.
void com.graphbuilder.math.FuncMap.loadDefaultFunctions | ( | ) |
Adds the mappings for many common functions.
The names are specified in all lowercase letters.
Definition at line 97 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.setFunction().
Referenced by edu.rice.cs.hpc.data.experiment.metric.AggregateMetric.AggregateMetric(), edu.rice.cs.hpc.viewer.metric.ExtDerivedMetricDlg.createDialogArea(), edu.rice.cs.hpc.data.experiment.metric.ExtFuncMap.init(), edu.rice.cs.hpc.data.experiment.metric.MetricVarMap.main(), and com.graphbuilder.test.MathTest.main().
void com.graphbuilder.math.FuncMap.remove | ( | String | funcName | ) |
Removes the function-name and the associated function from the map.
Does nothing if the function-name is not found.
Definition at line 234 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.caseSensitive, com.graphbuilder.math.FuncMap.func, com.graphbuilder.math.FuncMap.name, and com.graphbuilder.math.FuncMap.numFunc.
void com.graphbuilder.math.FuncMap.setFunction | ( | String | funcName, | |
Function | f | |||
) |
Assigns the name to map to the specified function.
IllegalArgumentException | If any of the parameters are null. |
Definition at line 166 of file FuncMap.java.
References com.graphbuilder.math.FuncMap.caseSensitive, com.graphbuilder.math.FuncMap.func, com.graphbuilder.math.FuncMap.name, and com.graphbuilder.math.FuncMap.numFunc.
Referenced by edu.rice.cs.hpc.data.experiment.metric.ExtFuncMap.init(), and com.graphbuilder.math.FuncMap.loadDefaultFunctions().
boolean com.graphbuilder.math.FuncMap.caseSensitive = false [private] |
Definition at line 86 of file FuncMap.java.
Referenced by com.graphbuilder.math.FuncMap.getFunction(), com.graphbuilder.math.FuncMap.isCaseSensitive(), com.graphbuilder.math.FuncMap.remove(), and com.graphbuilder.math.FuncMap.setFunction().
Function [] com.graphbuilder.math.FuncMap.func = new Function[50] [private] |
Definition at line 84 of file FuncMap.java.
Referenced by com.graphbuilder.math.FuncMap.getFunction(), com.graphbuilder.math.FuncMap.getFunctions(), com.graphbuilder.math.FuncMap.remove(), and com.graphbuilder.math.FuncMap.setFunction().
String [] com.graphbuilder.math.FuncMap.name = new String[50] [private] |
Definition at line 83 of file FuncMap.java.
Referenced by com.graphbuilder.math.FuncMap.getFunction(), com.graphbuilder.math.FuncMap.getFunctionNames(), com.graphbuilder.math.FuncMap.remove(), and com.graphbuilder.math.FuncMap.setFunction().
int com.graphbuilder.math.FuncMap.numFunc = 0 [private] |