public final class Variable
extends java.lang.Object
| Constructor and Description |
|---|
Variable(java.lang.String name,
Data data)
Constructs a variable from its name and associated data.
|
Variable(java.lang.String name,
DataType type)
Constructs an uninitialized variable of the specified type.
|
Variable(Variable variable)
Constructs a full copy of the given variable object.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(java.lang.Object obj) |
Data |
getData()
Returns a data object associated with the specified variable.
|
java.lang.String |
getName()
Returns the name of the variable.
|
DataType |
getType()
Returns the type of the variable.
|
int |
hashCode() |
boolean |
hasValue()
Checks whether the variable has a value assigned to it.
|
void |
setData(Data data)
Assigns a new data value to the variable.
|
java.lang.String |
toString() |
public Variable(java.lang.String name,
Data data)
name - Variable name.data - Data the variable refers to.java.lang.IllegalArgumentException - if any of the parameters equals null.public Variable(java.lang.String name,
DataType type)
name - Variable name.type - Variable type.java.lang.IllegalArgumentException - if any of the parameters equals null.public Variable(Variable variable)
variable - Variable object to be copied.public void setData(Data data)
data - A data value to be assigned to the variable.java.lang.IllegalArgumentException - if the parameter equals null.public java.lang.String getName()
public Data getData()
public DataType getType()
public boolean hasValue()
true if the variable has a value assigned or false otherwise.public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Object