public class Variable
extends java.util.Observable
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
name |
Modifier | Constructor and Description |
---|---|
protected |
Variable(java.lang.String name)
Constructors are protected.
|
protected |
Variable(java.lang.String name,
java.lang.Object value)
Constructors are protected.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName() |
java.lang.Object |
getValue() |
boolean |
hasValidValue()
Is the value of this variable valid?
|
boolean |
isConstant() |
void |
setIsConstant(boolean b) |
void |
setValidValue(boolean val)
Sets whether the value of variable is valid.
|
boolean |
setValue(java.lang.Object object)
Sets the value of the variable.
|
protected boolean |
setValueRaw(java.lang.Object object)
In general subclasses should override this method rather than
setValue.
|
java.lang.String |
toString()
Returns a string with the variable name followed by it's value.
|
protected Variable(java.lang.String name)
VariableFactory
which are in turned called by SymbolTable
.protected Variable(java.lang.String name, java.lang.Object value)
VariableFactory
which are in turned called by SymbolTable
.public java.lang.String getName()
public boolean isConstant()
public void setIsConstant(boolean b)
public java.lang.Object getValue()
public boolean hasValidValue()
public void setValidValue(boolean val)
public boolean setValue(java.lang.Object object)
This method call java.util.Observable.notifyObservers() to indicate to anyone interested that the value has been changed. Note subclasses should override setValueRaw rather than this method so they do not need to handle the Observable methods.
protected boolean setValueRaw(java.lang.Object object)
object
- public java.lang.String toString()
a: 10If the variable is a constant the string " (Constant" is appended.
toString
in class java.lang.Object
http://www.singularsys.com/jep Copyright © 2007 Singular Systems