public class Variables
extends java.lang.Object
A set of variables always defines a principal, that is, the model element for which a metric/set/rule is calculated. The principal is not necessarily the same element for which the expression is evaluated.
Constructor and Description |
---|
Variables(ModelElement principal)
Creates a new set of variables.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
getVariable(java.lang.String name)
Gets the value of a variable.
|
boolean |
hasVariable(java.lang.String name)
Tests whether a variable of a specified name is defined in this set.
|
void |
setVariable(java.lang.String name,
java.lang.Object value)
Sets the value of a variable.
|
public Variables(ModelElement principal)
principal
- Principal for this set.public void setVariable(java.lang.String name, java.lang.Object value)
name
- Name of the variable.value
- Value of the variable.public java.lang.Object getVariable(java.lang.String name)
name
- Name of the variable.public boolean hasVariable(java.lang.String name)
name
- Name of the variable to look up.true
if the variable is defined.