Record Class Expr.Num

All Implemented Interfaces:
Expr, Expr.Value
Enclosing interface:
Expr

public static record Expr.Num(double x) extends Record implements Expr.Value
Our internal representation of a number in the E0 language. See http://www.radford.edu/itec380/2022fall-ibarland/Project
  • Constructor Details

    • Num

      public Num(double x)
      Creates an instance of a Num record class.
      Parameters:
      x - the value for the x record component
  • Method Details

    • parse

      public static Expr.Num parse(Scanner s, String punctuation)
    • equals

      public boolean equals(Object that)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      that - the object with which to compare
      Returns:
      true if this object is the same as the that argument; false otherwise.
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • x

      public double x()
      Returns the value of the x record component.
      Returns:
      the value of the x record component