Public Member Functions | |
VarMap () | |
VarMap (boolean caseSensitive) | |
double | getValue (String varName) |
Returns the value associated with the specified variable name. | |
void | setValue (String varName, double val) |
Assigns the value to the specified variable name. | |
boolean | isCaseSensitive () |
Returns true if the case of the variable names is considered. | |
String[] | getVariableNames () |
Returns an array of exact length of the variable names stored in this map. | |
double[] | getValues () |
Returns an array of exact length of the values stored in this map. | |
void | remove (String varName) |
Removes the variable-name from the map. | |
Private Attributes | |
boolean | caseSensitive = true |
String[] | name = new String[2] |
double[] | value = new double[2] |
int | numVars = 0 |
VarMap maps a name to a value. A VarMap is used in the eval method of an Expression object. This class can be used as the default variable-map.
During the evaluation of an expression, if a variable is not supported then a RuntimeException is thrown. 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. By default, case sensitivity is true.
Definition at line 12 of file VarMap.java.
com.graphbuilder.math.VarMap.VarMap | ( | ) |
Definition at line 19 of file VarMap.java.
com.graphbuilder.math.VarMap.VarMap | ( | boolean | caseSensitive | ) |
Definition at line 23 of file VarMap.java.
double com.graphbuilder.math.VarMap.getValue | ( | String | varName | ) |
Returns the value associated with the specified variable name.
RuntimeException | If a matching variable name cannot be found. |
Reimplemented in edu.rice.cs.hpc.data.experiment.metric.CombineAggregateMetricVarMap, and edu.rice.cs.hpc.data.experiment.metric.MetricVarMap.
Definition at line 32 of file VarMap.java.
References com.graphbuilder.math.VarMap.caseSensitive, com.graphbuilder.math.VarMap.name, com.graphbuilder.math.VarMap.numVars, and com.graphbuilder.math.VarMap.value.
Referenced by com.graphbuilder.math.VarNode.eval().
double [] com.graphbuilder.math.VarMap.getValues | ( | ) |
Returns an array of exact length of the values stored in this map.
The returned array corresponds to the order of the names returned by getVariableNames.
Definition at line 97 of file VarMap.java.
References com.graphbuilder.math.VarMap.numVars, and com.graphbuilder.math.VarMap.value.
String [] com.graphbuilder.math.VarMap.getVariableNames | ( | ) |
Returns an array of exact length of the variable names stored in this map.
Definition at line 84 of file VarMap.java.
References com.graphbuilder.math.VarMap.name, and com.graphbuilder.math.VarMap.numVars.
boolean com.graphbuilder.math.VarMap.isCaseSensitive | ( | ) |
Returns true if the case of the variable names is considered.
Definition at line 77 of file VarMap.java.
References com.graphbuilder.math.VarMap.caseSensitive.
void com.graphbuilder.math.VarMap.remove | ( | String | varName | ) |
Removes the variable-name from the map.
Does nothing if the variable-name is not found.
Definition at line 109 of file VarMap.java.
References com.graphbuilder.math.VarMap.caseSensitive, com.graphbuilder.math.VarMap.name, com.graphbuilder.math.VarMap.numVars, and com.graphbuilder.math.VarMap.value.
void com.graphbuilder.math.VarMap.setValue | ( | String | varName, | |
double | val | |||
) |
Assigns the value to the specified variable name.
IllegalArgumentException | If the variable name is null. |
Definition at line 45 of file VarMap.java.
References com.graphbuilder.math.VarMap.caseSensitive, com.graphbuilder.math.VarMap.name, com.graphbuilder.math.VarMap.numVars, and com.graphbuilder.math.VarMap.value.
Referenced by edu.rice.cs.hpc.data.experiment.metric.MetricVarMap.main(), and com.graphbuilder.test.MathTest.main().
boolean com.graphbuilder.math.VarMap.caseSensitive = true [private] |
Definition at line 14 of file VarMap.java.
Referenced by com.graphbuilder.math.VarMap.getValue(), com.graphbuilder.math.VarMap.isCaseSensitive(), com.graphbuilder.math.VarMap.remove(), and com.graphbuilder.math.VarMap.setValue().
String [] com.graphbuilder.math.VarMap.name = new String[2] [private] |
Definition at line 15 of file VarMap.java.
Referenced by com.graphbuilder.math.VarMap.getValue(), com.graphbuilder.math.VarMap.getVariableNames(), com.graphbuilder.math.VarMap.remove(), and com.graphbuilder.math.VarMap.setValue().
int com.graphbuilder.math.VarMap.numVars = 0 [private] |
Definition at line 17 of file VarMap.java.
Referenced by com.graphbuilder.math.VarMap.getValue(), com.graphbuilder.math.VarMap.getValues(), com.graphbuilder.math.VarMap.getVariableNames(), com.graphbuilder.math.VarMap.remove(), and com.graphbuilder.math.VarMap.setValue().
double [] com.graphbuilder.math.VarMap.value = new double[2] [private] |