public class VariableTable extends java.util.Observable implements JepComponent
Variable.addObserver() to monitor individual variables.| Modifier and Type | Field and Description |
|---|---|
protected java.util.HashMap<java.lang.String,Variable> |
table |
protected VariableFactory |
vf |
| Constructor and Description |
|---|
VariableTable() |
VariableTable(VariableTable tbl) |
| Modifier and Type | Method and Description |
|---|---|
Variable |
addConstant(java.lang.String name,
java.lang.Object value)
Adds a new variable which is marked as a constant.
|
Variable |
addVariable(java.lang.String name)
Adds a new variable with no value specified.
|
Variable |
addVariable(java.lang.String name,
java.lang.Object value)
Adds a new variable with specified value.
|
void |
clear()
Clears all variables from the table.
|
void |
clearValues()
Clears the values of all non constant variables.
|
boolean |
containsKey(java.lang.String key) |
boolean |
containsVariable(Variable value) |
void |
copyConstantsFrom(VariableTable vt)
Copies all the constants from a variable table into this table
|
void |
copyVariablesFrom(VariableTable vt)
Copies all the variables from a variable table into this table
|
JepComponent |
getLightWeightInstance()
Returns a new empty VariableTable.
|
Variable |
getVariable(java.lang.String name)
Gets an existing variable, returns null if variable is not found.
|
VariableFactory |
getVariableFactory() |
java.util.Collection<Variable> |
getVariables()
Returns a list of all the variables in the table.
|
void |
init(Jep j)
Initialize the component.
|
boolean |
isEmpty() |
java.util.Set<java.lang.String> |
keySet()
Returns the names of all the variables.
|
Variable |
remove(java.lang.String varname)
Remove a variable with a given name from the table.
|
Variable |
remove(Variable var)
Remove a variable from the table.
|
void |
removeNonConstants()
Remove all variables from the table which are not constants.
|
void |
setVariableFactory(VariableFactory vf) |
int |
size() |
java.lang.String |
toString() |
java.util.Collection<Variable> |
values()
Deprecated.
|
protected java.util.HashMap<java.lang.String,Variable> table
protected transient VariableFactory vf
public VariableTable()
public VariableTable(VariableTable tbl)
public void init(Jep j)
JepComponentinit in interface JepComponentj - the current Jep instancepublic void setVariableFactory(VariableFactory vf)
public VariableFactory getVariableFactory()
public Variable addVariable(java.lang.String name)
Variable instance is created with the variable factory.name - the variable's namepublic Variable addVariable(java.lang.String name, java.lang.Object value) throws JepException
name - the name of the variablevalue - the value for the variable to be set toJepException - if an attempt is made to set the value of a constant variablepublic Variable addConstant(java.lang.String name, java.lang.Object value) throws JepException
name - value - JepException - if an attempt is made to set the value of an
existing constant variablepublic Variable getVariable(java.lang.String name)
name - public void clear()
public boolean isEmpty()
public java.util.Set<java.lang.String> keySet()
public java.util.Collection<Variable> getVariables()
public Variable remove(java.lang.String varname)
varname - name of the variable to removepublic Variable remove(Variable var)
var - the variable to remove@Deprecated public java.util.Collection<Variable> values()
getVariables()public int size()
public boolean containsKey(java.lang.String key)
public boolean containsVariable(Variable value)
public java.lang.String toString()
toString in class java.lang.Objectpublic JepComponent getLightWeightInstance()
getLightWeightInstance in interface JepComponentcopyConstantsFrom(VariableTable),
copyVariablesFrom(VariableTable)public void copyConstantsFrom(VariableTable vt)
vt - source variable tablepublic void copyVariablesFrom(VariableTable vt)
vt - source variable tablepublic void clearValues()
Variable.setValidValue(boolean) to false.public void removeNonConstants()
Copyright © 2018 Singular Systems http://www.singularsys.com/jep