org.hackystat.telemetry.analyzer.evaluator
Class VariableResolver

java.lang.Object
  extended by org.hackystat.telemetry.analyzer.evaluator.VariableResolver

public class VariableResolver
extends java.lang.Object

Variable resolver. It maps Variables to Constants.

Author:
(Cedric) Qin ZHANG

Constructor Summary
VariableResolver()
           
 
Method Summary
 void add(Variable variable, Constant constant)
          Adds a variable-constant pair so that later the variable can be resolved.
 Constant resolve(Variable variable)
          Resolves a variable to a constant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariableResolver

public VariableResolver()
Method Detail

add

public void add(Variable variable,
                Constant constant)
         throws TelemetryEvaluationException
Adds a variable-constant pair so that later the variable can be resolved.

Parameters:
variable - The variable.
constant - The constant.
Throws:
TelemetryEvaluationException - If a variable with the same name has already been added.

resolve

public Constant resolve(Variable variable)
                 throws TelemetryEvaluationException
Resolves a variable to a constant.

Parameters:
variable - The variable to be resolved.
Returns:
The constant the variable resolves to.
Throws:
TelemetryEvaluationException - If the variable cannot be resolved to a constant.