Record Class Num
-
Field Summary
Fields inherited from interface Expr
PUNCTUATION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) doubleReturn the Java double this Value represents (for use by other primitives in our language.)booleanIndicates whether some other object is "equal to" this one.eval()Evaluate a given Expr.final inthashCode()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.doublex()Returns the value of thexrecord component.
-
Constructor Details
-
Num
public Num(double x) Creates an instance of aNumrecord class.- Parameters:
x- the value for thexrecord component
-
-
Method Details
-
eval
Description copied from interface:ExprEvaluate 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 thecomparemethod from their corresponding wrapper classes. -
hashCode
-
x
public double x()Returns the value of thexrecord component.- Returns:
- the value of the
xrecord component
-