|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.util.Observable com.singularsys.jep.VariableTable
public class VariableTable
A table of variables.
This class implements Observable and observers will be notified
when new variables are added, or removed, but not when their values are changed.
Use Variable.addObserver()
to monitor individual variables.
for a base class for monotoring a VariableTable.
,
Serialized FormField Summary | |
---|---|
protected java.util.HashMap<java.lang.String,Variable> |
table
|
protected VariableFactory |
vf
|
Constructor Summary | |
---|---|
VariableTable()
|
|
VariableTable(VariableTable tbl)
|
Method Summary | |
---|---|
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 all the variable 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 |
setVariableFactory(VariableFactory vf)
|
int |
size()
|
java.lang.String |
toString()
|
java.util.Collection<Variable> |
values()
Deprecated. |
Methods inherited from class java.util.Observable |
---|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap<java.lang.String,Variable> table
protected transient VariableFactory vf
Constructor Detail |
---|
public VariableTable()
public VariableTable(VariableTable tbl)
Method Detail |
---|
public void init(Jep j)
JepComponent
init
in interface JepComponent
j
- 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 name
public 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 to
JepException
- 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 remove
public Variable remove(Variable var)
var
- the variable to remove
@Deprecated public java.util.Collection<Variable> values()
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.Object
public JepComponent getLightWeightInstance()
getLightWeightInstance
in interface JepComponent
copyConstantsFrom(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.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |