Class Value

java.lang.Object
  extended by Expr
      extended by Value
Direct Known Subclasses:
Num

public abstract class Value
extends Expr

Abstract class Value - The type of all Expressions which self-evaluate: Numbers, and (later, in Q3) functions. See http://www.radford.edu/itec380/2009fall-ibarland/Hw06/hw06.html (This architecture works as long as every value is a type of Expression, which is a nice feature to have in a language; it means that any result can be pasted/substituted into larger expressions, which promotes a substitution model of evaluation.)

Version:
2014.Nov.04
Author:
Ian Barland

Field Summary
 
Fields inherited from class Expr
PUNCTUATION
 
Constructor Summary
Value()
           
 
Method Summary
 Value eval()
          Evaluate a given Expr.
 int hashCode()
           
 
Methods inherited from class Expr
parse, parse, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Value

public Value()
Method Detail

eval

public Value eval()
Description copied from class: Expr
Evaluate a given Expr.

Specified by:
eval in class Expr
Returns:
the Value this Expr evaluates to. (In O0, all values are numbers (doubles), but in O3 that will change, which is why we have pre-emptively made the return type 'Value'.)

hashCode

public int hashCode()
Overrides:
hashCode in class Expr