Package cs2110
Class Constant
java.lang.Object
cs2110.Constant
- All Implemented Interfaces:
Expression
An expression tree node representing a fixed real number.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionA Constant has no dependencies.boolean
Return whether `other` is a Constant of the same class with the same value.double
Return this node's value.int
hashCode()
Return the decimal representation of this node's value (with sufficient precision to reproduce its binary value).int
opCount()
No operations are required to evaluate a Constant's value.Return self (a Constant is already fully optimized).Return the decimal representation of this node's value (with sufficient precision to reproduce its binary value).toString()
-
Constructor Details
-
Method Details
-
eval
Return this node's value.- Specified by:
eval
in interfaceExpression
-
opCount
public int opCount()No operations are required to evaluate a Constant's value.- Specified by:
opCount
in interfaceExpression
-
infixString
Return the decimal representation of this node's value (with sufficient precision to reproduce its binary value).- Specified by:
infixString
in interfaceExpression
-
postfixString
Return the decimal representation of this node's value (with sufficient precision to reproduce its binary value).- Specified by:
postfixString
in interfaceExpression
-
equals
Return whether `other` is a Constant of the same class with the same value. -
dependencies
A Constant has no dependencies.- Specified by:
dependencies
in interfaceExpression
-
optimize
Return self (a Constant is already fully optimized).- Specified by:
optimize
in interfaceExpression
-
toString
-
hashCode
public int hashCode()
-