6 * represents a symbol in the language (var name, function name, etc).
9 public class TypeDescriptor extends Descriptor {
10 public static final int BYTE=1;
11 public static final int SHORT=2;
12 public static final int INT=3;
13 public static final int LONG=4;
14 public static final int CHAR=5;
15 public static final int BOOLEAN=6;
16 public static final int FLOAT=7;
17 public static final int DOUBLE=8;
18 public static final int VOID=9;
19 public static final int NULL=10;
20 public static final int CLASS=11;
25 ClassDescriptor class_desc;
27 public boolean isByte() {
30 public boolean isShort() {
33 public boolean isInt() {
36 public boolean isLong() {
39 public boolean isChar() {
42 public boolean isBoolean() {
45 public boolean isFloat() {
48 public boolean isDouble() {
53 public void setClassDescriptor(ClassDescriptor cd) {
57 public boolean isVoid() {
61 public boolean isPrimitive() {
62 return ((type>=BYTE)&&(type<=DOUBLE));
65 public boolean isClass() {
69 public TypeDescriptor(NameDescriptor name) {
70 super(name.toString());
75 public ClassDescriptor getClassDesc() {
79 public TypeDescriptor(ClassDescriptor cd) {
80 super(cd.getSymbol());
85 public TypeDescriptor(int t) {
90 public String toString() {
94 return decodeInt(type);
97 private static String decodeInt(int type) {
100 else if (type==BOOLEAN)
102 else if (type==SHORT)
110 else if (type==FLOAT)
112 else if (type==DOUBLE)
118 else throw new Error();