protected String identifier;
protected ExpressionNode en;
private boolean isglobal;
+ private boolean isenum;
+ private int enumvalue;
+
+ private ClassDescriptor cn;
public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e, boolean isglobal) {
super(identifier);
this.safename = "___" + name + "___";
this.uniqueid=count++;
this.isglobal=isglobal;
- if (en!=null) throw new Error("Field initializers not implemented");
+ this.isenum = false;
+ this.enumvalue = -1;
+ }
+
+ public ClassDescriptor getClassDescriptor() {
+ return this.cn;
+ }
+
+ public void setClassDescriptor(ClassDescriptor cn) {
+ this.cn = cn;
+ }
+
+ public String getSafeSymbol() {
+ if (isStatic()) {
+ return cn.getSafeSymbol()+safename;
+ } else
+ return safename;
+ }
+
+ public boolean isEnum() {
+ return this.isenum;
+ }
+
+ public int enumValue() {
+ return this.enumvalue;
+ }
+
+ public void setAsEnum() {
+ this.isenum = true;
+ }
+
+ public void setEnumValue(int value) {
+ this.enumvalue = value;
+ }
+
+ public ExpressionNode getExpressionNode() {
+ return en;
+ }
+
+ public boolean isFinal() {
+ return modifier.isFinal();
+ }
+
+ public boolean isStatic() {
+ return modifier.isStatic();
+ }
+
+ public boolean isVolatile() {
+ return modifier.isVolatile();
}
public boolean isGlobal() {
return td;
}
- public boolean equals( Object o ) {
- if( o == null ) return false;
- if( !(o instanceof FieldDescriptor) ) return false;
-
- FieldDescriptor fd = (FieldDescriptor) o;
- if( modifier == null && fd.modifier != null ) return false;
- if( modifier != null && !modifier.equals( fd.modifier ) ) return false;
- if( !(td == fd.td) ) return false;
- if( !(en == fd.en) ) return false;
- if( !isglobal == fd.isglobal ) return false;
- if( identifier == null && fd.identifier != null ) return false;
- if( identifier != null && !identifier.equals( fd.identifier ) ) return false;
- return true;
- }
-
- public int hashCode() {
- int hashCode = modifier.hashCode();
- hashCode += td.hashCode();
- if( en != null ) hashCode += 81;
- if( isglobal ) hashCode += 11;
- if( identifier != null ) hashCode += identifier.hashCode();
- return hashCode;
+ public void changeSafeSymbol(int id) {
+ safename+=id;
}
public String toString() {
}
public String toStringBrief() {
- return td.toString()+" "+getSymbol();
+ return td.toPrettyString()+" "+getSymbol();
+ }
+
+ public String toPrettyStringBrief() {
+ return td.toPrettyString()+" "+getSymbol();
}
}