+ public boolean isOffset() {
+ return type==OFFSET;
+ }
+
+ public boolean isPtr() {
+ return (isClass()||isNull()||isTag()||isArray());
+ }
+
+ public boolean isIntegerType() {
+ return (isInt()||isLong()||isShort()||isChar()||isByte()||isEnum());
+ }
+
+ public void setClassDescriptor(ClassDescriptor cd) {
+ class_desc=cd;
+ }
+
+ public boolean isPrimitive() {
+ return (((type>=BYTE)&&(type<=DOUBLE)) || isEnum());
+ }
+
+ public boolean isEnum() {
+ if(this.type != CLASS) {
+ return false;
+ } else if(this.class_desc != null) {
+ return this.class_desc.isEnum();
+ }
+ return false;
+ }
+
+ public boolean isClass() {
+ return (type==CLASS && !isEnum());
+ }
+
+ public boolean isTag() {
+ return type==TAG;
+ }
+
+ public boolean isImmutable() {
+ return isPrimitive();
+ }
+
+ public TypeDescriptor(NameDescriptor name) {
+ super(name.toString());
+ this.type=CLASS;
+ this.class_desc=null;
+ this.arraycount=0;
+ this.isClassNameRef =false;
+ this.annotationSet=new Vector<AnnotationDescriptor>();
+ }
+
+ public TypeDescriptor(String st) {
+ super(st);
+ this.type=CLASS;
+ this.class_desc=null;
+ this.arraycount=0;
+ this.isClassNameRef =false;
+ this.annotationSet=new Vector<AnnotationDescriptor>();
+ }
+
+ public ClassDescriptor getClassDesc() {
+ return class_desc;
+ }
+
+ public TypeDescriptor(ClassDescriptor cd) {
+ super(cd.getSymbol());
+ this.type=CLASS;
+ this.class_desc=cd;
+ this.arraycount=0;
+ this.isClassNameRef =false;
+ this.annotationSet=new Vector<AnnotationDescriptor>();
+ }
+
+ public TypeDescriptor(int t) {
+ super(decodeInt(t));
+ this.type=t;
+ this.arraycount=0;
+ this.isClassNameRef =false;
+ this.annotationSet=new Vector<AnnotationDescriptor>();
+ }
+
+ public String toString() {
+ if (type==CLASS) {
+ return name;
+ } else
+ return decodeInt(type);
+ }
+
+ public String toPrettyString() {
+ String str=name;
+ if (type!=CLASS) {
+ str=decodeInt(type);
+ }
+ for(int i=0; i<arraycount; i++)
+ str+="[]";
+ return str;
+ }
+
+ private static String decodeInt(int type) {
+ if (type==BYTE)
+ return "byte";
+ else if (type==BOOLEAN)
+ return "boolean";
+ else if (type==SHORT)
+ return "short";
+ else if (type==INT)
+ return "int";
+ else if (type==LONG)
+ return "long";
+ else if (type==CHAR)
+ return "char";
+ else if (type==FLOAT)
+ return "float";
+ else if (type==DOUBLE)
+ return "double";
+ else if (type==VOID)
+ return "void";
+ else if (type==NULL)
+ return "NULL";
+ else if (type==TAG)
+ return TypeUtil.TagClass;
+ else if (type==OFFSET)
+ return "offset";
+ else throw new Error();
+ }
+
+ public void addAnnotationMarker(AnnotationDescriptor an) {
+ annotationSet.add(an);
+ }
+
+ public Vector<AnnotationDescriptor> getAnnotationMarkers() {
+ return annotationSet;
+ }
+
+ public void setExtension(TypeExtension te) {
+ typeExtension=te;
+ }
+
+ public TypeExtension getExtension() {
+ return typeExtension;
+ }