public class BasicVariables extends java.lang.Object implements Variables
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID |
private java.util.HashMap |
vars
Contains the values of declared variables
|
Constructor and Description |
---|
BasicVariables() |
Modifier and Type | Method and Description |
---|---|
void |
declareVariable(java.lang.String varName,
java.lang.Object value)
Defines a new variable with the specified value or modifies
the value of an existing variable.
|
java.lang.Object |
getVariable(java.lang.String varName)
Returns the value of the variable if it is defined,
otherwise, throws IllegalArgumentException
|
boolean |
isDeclaredVariable(java.lang.String varName)
Returns true if the variable has been defined, even if the
value of the variable is null.
|
java.lang.String |
toString() |
void |
undeclareVariable(java.lang.String varName)
Removes an existing variable.
|
private static final long serialVersionUID
private java.util.HashMap vars
public boolean isDeclaredVariable(java.lang.String varName)
isDeclaredVariable
in interface Variables
varName
- is a variable name without the "$" signpublic java.lang.Object getVariable(java.lang.String varName)
getVariable
in interface Variables
varName
- is a variable name without the "$" signpublic void declareVariable(java.lang.String varName, java.lang.Object value)
declareVariable
in interface Variables
varName
- is a variable name without the "$" signvalue
- is the new value for the variable, which can be nullpublic void undeclareVariable(java.lang.String varName)
undeclareVariable
in interface Variables
varName
- is a variable name without the "$" signpublic java.lang.String toString()
toString
in class java.lang.Object