CS 536 Fall 2007, Project 5

Enum Type.BaseType

Object
  extended by Enum<Type.BaseType>
      extended by Type.BaseType
All Implemented Interfaces:
Serializable, Comparable<Type.BaseType>
Enclosing class:
Type

public static enum Type.BaseType
extends Enum<Type.BaseType>

Basic types: int, bool, void, string, or error.


Enum Constant Summary
BOOL
          A boolean.
ERROR
          The "type" of an expression that contains a type error.
INT
          An integer.
STRING
          A string constant.
VOID
          The "return" type for a PROC.
 
Method Summary
 String toString()
          Converts this type into String for debugging.
static Type.BaseType valueOf(String name)
          Returns the enum constant of this type with the specified name.
static Type.BaseType[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf
 
Methods inherited from class Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

INT

public static final Type.BaseType INT
An integer.


BOOL

public static final Type.BaseType BOOL
A boolean.


VOID

public static final Type.BaseType VOID
The "return" type for a PROC.


STRING

public static final Type.BaseType STRING
A string constant.


ERROR

public static final Type.BaseType ERROR
The "type" of an expression that contains a type error. Used to avoid cascading errors.

Method Detail

values

public static final Type.BaseType[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(Type.BaseType c : Type.BaseType.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static Type.BaseType valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

toString

public String toString()
Converts this type into String for debugging.

Overrides:
toString in class Enum<Type.BaseType>
Returns:
a lower-case string such as "int" or "error".

CS 536 Fall 2007, Project 5