//File: Negation.java //Name: Trai Pham //Date: 02/16/2020 //Course: CSE 8B /** Not sure what Negation does */ public class Negation extends BooleanExpression{ public Negation(BooleanExpression someVar){ this.a = someVar; } public Value evaluate(){ if(!(this.a instanceof BooleanExpression)){ return null; } if(this.a == null){ return null; } // BooleanValue var = this.a.boolEvaluate(); //use both evaluate, boolEvaluate, typecasting, and instanceof //convert Value to BooleanValue Value test = this.a.evaluate(); BooleanValue try01 = (BooleanValue) test; //apply negation to variable of value Value negate = new BooleanValue(!(try01.boolEvaluate())); return negate; } }