home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 1999 March / maximum-cd-1999-03.iso / Feature / Lotus / ORGANIZE / COMPNENT / LTOUIN21.ZIP / sunw / demo / classfile / FloatConstant.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-12  |  1.0 KB  |  39 lines

  1. package sunw.demo.classfile;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5.  
  6. class FloatConstant extends ConstantPoolEntry {
  7.    private float floating;
  8.  
  9.    FloatConstant(float var1, ClassFile var2) {
  10.       super((byte)4, var2);
  11.       this.floating = var1;
  12.       ((ConstantPoolEntry)this).addToConstantPool();
  13.    }
  14.  
  15.    public boolean equals(Object var1) {
  16.       if (var1 instanceof Float) {
  17.          return this.floating == (Float)var1;
  18.       } else if (var1 instanceof FloatConstant) {
  19.          FloatConstant var2 = (FloatConstant)var1;
  20.          return this.floating == var2.getValue();
  21.       } else {
  22.          return false;
  23.       }
  24.    }
  25.  
  26.    float getValue() {
  27.       return this.floating;
  28.    }
  29.  
  30.    public int hashCode() {
  31.       return (int)this.floating;
  32.    }
  33.  
  34.    void write(DataOutputStream var1) throws IOException {
  35.       var1.writeByte(((ConstantPoolEntry)this).getTag());
  36.       var1.writeFloat(this.floating);
  37.    }
  38. }
  39.