Class Constant

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

public class Constant
extends java.lang.Object
implements Expression

A Constant is an expression with a directly specified value.


Constructor Summary
Constant(java.lang.Object value)
          Creates a Constant with the specified value.
 
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

Constant

public Constant(java.lang.Object value)
Creates a Constant with the specified value.

Parameters:
value - the value the expression should evaluate to
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