Record Class Num
-
Field Summary
Fields inherited from interface Expr
PUNCTUATION
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) double
Return the Java double this Value represents (for use by other primitives in our language.)boolean
Indicates whether some other object is "equal to" this one.eval()
Evaluate a given Expr.final int
hashCode()
Returns a hash code value for this object.static Num
“@Override”Expr.parse(java.lang.String)
toString()
Returns a string representation of this record class.double
x()
Returns the value of thex
record component.
-
Constructor Details
-
Num
public Num(double x) Creates an instance of aNum
record class.- Parameters:
x
- the value for thex
record component
-
-
Method Details
-
eval
Description copied from interface:Expr
Evaluate a given Expr. -
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. -
parse
“@Override”Expr.parse(java.lang.String)
-
doubleValue
double doubleValue()Return the Java double this Value represents (for use by other primitives in our language.)- Returns:
- the Java double this Value represents.
-
equals
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 thecompare
method from their corresponding wrapper classes. -
hashCode
-
x
public double x()Returns the value of thex
record component.- Returns:
- the value of the
x
record component
-