public class Variable extends Observable
| Modifier | Constructor and Description |
|---|---|
protected |
Variable(String name)
Constructors are protected.
|
protected |
Variable(String name,
Object value)
Constructors are protected.
|
| Modifier and Type | Method and Description |
|---|---|
String |
getName() |
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(Object object)
Sets the value of the variable.
|
protected boolean |
setValueRaw(Object object)
In general subclasses should override this method rather than
setValue.
|
String |
toString()
Returns a string with the variable name followed by it's value.
|
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedprotected String name
protected Variable(String name)
VariableFactory
which are in turned called by SymbolTable.protected Variable(String name, Object value)
VariableFactory
which are in turned called by SymbolTable.public String getName()
public boolean isConstant()
public void setIsConstant(boolean b)
public Object getValue()
public boolean hasValidValue()
public void setValidValue(boolean val)
public boolean setValue(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(Object object)
object - public String toString()
a: 10If the variable is a constant the string " (Constant" is appended.
Copyright © 2018. All rights reserved.