/** Our internal representation of a Paren * in the R0 language. * See http://www.radford.edu/itec380/2009fall-ibarland/Hw06/hw06.html * * @author Ian Barland * @version 2016.Nov.15 */ public class Paren extends Expr { Expr e; Paren( Expr _e ) { this.e = _e; } public String toString(/* Paren this */) { return "<" + this.e.toString() + ">" ; } public Value eval() { return this.e.eval(); } @Override public boolean equals( /* Paren this, */ Object that) { if (this==that) { return true; } else if (that==null) { return false; } else if (this.getClass() != that.getClass()) { return false; } else { Paren thatt = (Paren) that; return this.e.equals(thatt.e); } } @Override public int hashCode() { if (cachedHash == null) { int hashSoFar = (int)0x31476096bdd65159L; // fingerprint hashSoFar += this.e.hashCode(); cachedHash = hashSoFar; } return cachedHash; } private Integer cachedHash = null; }