gov.llnl.babel.ast

Class EnumItem

Implemented Interfaces:
INameable

public class EnumItem
extends ASTNode
implements INameable

A single item inside an enumeration. It has a name and (minimally) and implicit value. The value may also be set explicitly. The name and final value should both be unique to the enumeration.

Field Summary

Fields inherited from class gov.llnl.babel.ast.ASTNode

ILLEGAL_NODEID

Constructor Summary

EnumItem()
EnumItem(ParseTreeNode src)
EnumItem(ParseTreeNode src, ASTNode parent)

Method Summary

Object
accept(Visitor v, Object data)
implements "Visitor Pattern"
IntLiteral
getExplicitValue()
Name
getName()
int
getValue()
boolean
hasValue()
boolean
isUserValue()
void
setExplicitValue(IntLiteral intLiteral)
void
setName(Name name)
void
setValue(int i)
String
toString()

Methods inherited from class gov.llnl.babel.ast.ASTNode

accept, getFilename, getFirstToken, getLastToken, getNodeId, getParent, getParseTreeNode, getSymbolTableEntry, setFirstToken, setLastToken, setNodeId, setParent, setParseTreeNode, setSymbolTableEntry

Constructor Details

EnumItem

public EnumItem()

EnumItem

public EnumItem(ParseTreeNode src)

EnumItem

public EnumItem(ParseTreeNode src,
                ASTNode parent)
Parameters:
src - the ParseTreeNode useful for debugging (or null) for generated code
parent - the parent ASTNode.

Method Details

accept

public Object accept(Visitor v,
                     Object data)
implements "Visitor Pattern"
Overrides:
accept in interface ASTNode
Parameters:
v - The visitor class
data - Optional extra data
Returns:
Optional extra data

getExplicitValue

public IntLiteral getExplicitValue()

getName

public Name getName()
Specified by:
getName in interface INameable

getValue

public int getValue()
            throws java.lang.NullPointerException

hasValue

public boolean hasValue()

isUserValue

public boolean isUserValue()

setExplicitValue

public void setExplicitValue(IntLiteral intLiteral)

setName

public void setName(Name name)
Specified by:
setName in interface INameable

setValue

public void setValue(int i)

toString

public String toString()