Class Variable

java.lang.Object
  extended by Variable
All Implemented Interfaces:
Expression

public class Variable
extends java.lang.Object
implements Expression

A Variable is a name used as an expression.


Constructor Summary
Variable(java.lang.String name)
          Creates a Variable with the specified name.
 
Method Summary
 java.lang.Object eval(Environment env)
          Evaluate this expression.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variable

public Variable(java.lang.String name)
Creates a Variable with the specified name.

Parameters:
name - the name for this variable
Method Detail

eval

public java.lang.Object eval(Environment env)
Description copied from interface: Expression
Evaluate this expression. When an Expression is evaluated, this must happen in some particular environment. For example, evaluating the variable x in one environment might produce a totally different value than evaluating it in another environment.

Specified by:
eval in interface Expression
Parameters:
env - the environment in which the expression should be evaluated
Returns:
the value produced by the expression