Class ParityExpr

java.lang.Object
  extended by Expr
      extended by ParityExpr

public class ParityExpr
extends Expr

Our internal representation of a ParityExpr in the Q0 language. See http://www.radford.edu/itec380/2015fall-ibarland/Project

Version:
2015.Nov.09
Author:
Ian Barland

Field Summary
(package private)  Expr cond
           
(package private)  Expr evenPart
           
(package private)  Expr oddPart
           
(package private) static String TOKEN
           
 
Fields inherited from class Expr
PUNCTUATION
 
Constructor Summary
ParityExpr(Expr _cond, Expr _evenPart, Expr _oddPart)
           
 
Method Summary
 boolean equals(Object that)
           
 Value eval()
          Evaluate a given Expr.
 int hashCode()
           
 String toString()
          Return a String representation of this Expr.
 
Methods inherited from class Expr
parse, parse
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

cond

Expr cond

evenPart

Expr evenPart

oddPart

Expr oddPart

TOKEN

static final String TOKEN
See Also:
Constant Field Values
Constructor Detail

ParityExpr

ParityExpr(Expr _cond,
           Expr _evenPart,
           Expr _oddPart)
Method Detail

equals

public boolean equals(Object that)
Overrides:
equals in class Object

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

toString

public String toString()
Description copied from class: Expr
Return a String representation of this Expr. The result will be something which can be passed into 'parse(String)' to get the same Expr back. That is, toString and parse are inverses of each other.

Specified by:
toString in class Expr
Returns:
a String representation of this Expr.