Class IfZero


public class IfZero extends Expr
Our internal representation of a IfZero expr in the A0 language. See http://www.radford.edu/itec380/2022spring-ibarland/Project
  • Method Details

    • 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.
    • parse

      public static IfZero parse(Scanner s, String punctuation)
    • 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 X0, all values are numbers (doubles), but in X3 that will change, which is why we have pre-emptively made the return type 'Value'.)
    • equals

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

      public int hashCode()
      Overrides:
      hashCode in class Object