gov.llnl.babel.ast
Class EnumItem

java.lang.Object
  extended by gov.llnl.babel.ast.ASTNode
      extended by gov.llnl.babel.ast.EnumItem
All 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
 java.lang.Object accept(Visitor v, java.lang.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)
           
 java.lang.String toString()
           
 
Methods inherited from class gov.llnl.babel.ast.ASTNode
getFilename, getFirstToken, getLastToken, getNodeId, getParent, getParseTreeNode, getSymbolTableEntry, setFirstToken, setLastToken, setNodeId, setParent, setParseTreeNode, setSymbolTableEntry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EnumItem

public EnumItem(ParseTreeNode src)

EnumItem

public EnumItem(ParseTreeNode src,
                ASTNode parent)

EnumItem

public EnumItem()
Method Detail

getName

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

setName

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

hasValue

public boolean hasValue()

getValue

public int getValue()
             throws java.lang.NullPointerException
Throws:
java.lang.NullPointerException

setValue

public void setValue(int i)

isUserValue

public boolean isUserValue()

getExplicitValue

public IntLiteral getExplicitValue()

setExplicitValue

public void setExplicitValue(IntLiteral intLiteral)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

accept

public java.lang.Object accept(Visitor v,
                               java.lang.Object data)
Description copied from class: ASTNode
implements "Visitor Pattern"

Specified by:
accept in class ASTNode
Parameters:
v - The visitor class
data - Optional extra data
Returns:
Optional extra data