public final class Variable
extends java.lang.Object
Variable
class describes a variable that can be used as input or
output data in constraints.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(java.lang.String name,
Value<Data> data)
Constructs a variable from its name and associated dynamic data.
|
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, Value<Data> data)
name
- Variable name.data
- Dynamic value.java.lang.IllegalArgumentException
- if any of the parameters equals null
.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)
null
.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.java.lang.IllegalArgumentException
- if the parameter equals null
.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()
Data
object associated with the variable.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.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object