|
CS 536 Fall 2007, Project 5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
ObjectType
public class Type
A object representing a type in the Ada536 langauge.
| Nested Class Summary | |
|---|---|
static class |
Type.BaseType
Basic types: int, bool, void, string, or error. |
static class |
Type.Kind
One of SCALAR, PROCEDURE, or ARRAY. |
| Field Summary | |
|---|---|
Type.BaseType |
baseType
The "base" type. |
static Type |
ERROR
A constant Type representing the "type" of an expression that contains a type error. |
Type.Kind |
kind
The "kind" of this type. |
ProcDeclNode.Mode[] |
paramModes
The modes of the parameters to this function. |
String[] |
paramNames
The names of the parameters to this function. |
Type[] |
paramTypes
The types of the parameters to this function. |
int |
size
The size of this array type. |
| Constructor Summary | |
|---|---|
Type(String[] paramNames,
Type[] paramTypes,
ProcDeclNode.Mode[] paramModes,
Type.BaseType returnType)
Creates a new PROCEDURE type. |
|
Type(Type.BaseType baseType)
Creates a new SCALAR type. |
|
Type(Type.BaseType baseType,
int size)
Creates a new ARRAY type. |
|
| Method Summary | |
|---|---|
int |
bytes()
Returns the size, in bytes, of an instance of this type. |
boolean |
isBool()
Tests whether this Type is the scalar type BOOL. |
boolean |
isError()
Tests whether this Type is the scalar type ERROR. |
boolean |
isInt()
Tests whether this Type is the scalar type INT. |
boolean |
matches(Type that)
Tests whether this Type matches other Type. |
String |
toString()
Converts this type into String for debugging. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final Type.Kind kind
public static final Type ERROR
public final Type.BaseType baseType
public final String[] paramNames
public final Type[] paramTypes
public final ProcDeclNode.Mode[] paramModes
public final int size
| Constructor Detail |
|---|
public Type(Type.BaseType baseType)
baseType - the baseType.
public Type(Type.BaseType baseType,
int size)
baseType - the element type of the array.size - the number of elements in the array.
public Type(String[] paramNames,
Type[] paramTypes,
ProcDeclNode.Mode[] paramModes,
Type.BaseType returnType)
paramNames - the names of the parameters.paramTypes - the types of the parameters.paramModes - the modes of the parameters.returnType - the type returned by the function.| Method Detail |
|---|
public String toString()
toString in class Objectpublic boolean matches(Type that)
that - the other type.
public boolean isInt()
public boolean isBool()
public boolean isError()
public int bytes()
|
CS 536 Fall 2007, Project 5 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||