www.sdmetrics.com

com.sdmetrics.metrics
Class Variables

java.lang.Object
  extended by com.sdmetrics.metrics.Variables

public class Variables
extends java.lang.Object

Contains the names and values of variables to use when evaluating metric, set, or condition expressions.

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 Summary
Variables(ModelElement principal)
          Creates a new set of variables.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variables

public Variables(ModelElement principal)
Creates a new set of variables.

Parameters:
principal - Principal for this set.
Method Detail

setVariable

public void setVariable(java.lang.String name,
                        java.lang.Object value)
Sets the value of a variable. Adds the variable if it is not already defined in the set. Otherwise, replaces the value of the existing variable with the new value.

Parameters:
name - Name of the variable.
value - Value of the variable.

getVariable

public java.lang.Object getVariable(java.lang.String name)
Gets the value of a variable.

Parameters:
name - Name of the variable.
Returns:
Value of the variable.

hasVariable

public boolean hasVariable(java.lang.String name)
Tests whether a variable of a specified name is defined in this set.

Parameters:
name - Name of the variable to look up.
Returns:
true if the variable is defined.

www.sdmetrics.com