/* An instance of this class represents an atomic expression, meaning one ** involving no operators. ** ** Author: R. McCloskey ** Date: Feb. 2022 */ public class ExprTreeAtomic extends ExprTree { // instance variable // ----------------- private final int val; // the value of this expression // constructor // ----------- /* Initializes this atomic expression to have the given value. */ public ExprTreeAtomic(int number) { super(); val = number; } // observer // -------- @Override public int valueOf() { return val; } /* Note that the expression-string describing an atomic expression ** is the same, regardless of the "print mode". */ @Override public String toString(int mode) { return "" + val; } }