Package net.hydromatic.morel.ast
Class Core.Literal
java.lang.Object
net.hydromatic.morel.ast.AstNode
net.hydromatic.morel.ast.Core.BaseNode
net.hydromatic.morel.ast.Core.Exp
net.hydromatic.morel.ast.Core.Literal
- Enclosing class:
Core
Code of a literal (constant).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAccepts a shuttle, calling theShuttle.visit(net.hydromatic.morel.ast.Ast.Literal)method appropriate to the type of this node, and returning the result.voidAccepts a visitor, calling theShuttle.visit(net.hydromatic.morel.ast.Ast.Literal)method appropriate to the type of this node, and returning the result.booleaninthashCode()booleanReturns whether this expression is a constant.(package private) AstWriter<C> CReturns the value of this literal as a given class, or throwsClassCastException.(package private) static ComparableMethods inherited from class net.hydromatic.morel.ast.Core.Exp
arg, forEachArg, isCallTo, type
-
Field Details
-
value
-
-
Constructor Details
-
Literal
Literal(Op op, Type type, Comparable value) Creates a Literal.
-
-
Method Details
-
wrap
-
unwrap
Returns the value of this literal as a given class, or throwsClassCastException. If the class is notComparable, the value will be in a wrapper. -
hashCode
public int hashCode() -
equals
-
accept
Description copied from class:AstNodeAccepts a shuttle, calling theShuttle.visit(net.hydromatic.morel.ast.Ast.Literal)method appropriate to the type of this node, and returning the result. -
accept
Description copied from class:AstNodeAccepts a visitor, calling theShuttle.visit(net.hydromatic.morel.ast.Ast.Literal)method appropriate to the type of this node, and returning the result.- Overrides:
acceptin classCore.BaseNode
-
unparse
-
isConstant
public boolean isConstant()Description copied from class:Core.ExpReturns whether this expression is a constant.Examples include literals
1,true, constructors applied to constants, records and tuples whose arguments are constant.- Overrides:
isConstantin classCore.Exp
-