home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / VPage / Java.bin / CLASSES.ZIP / sun / tools / asm / NumberConstantData.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-07-08  |  1.3 KB  |  41 lines

  1. package sun.tools.asm;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5. import sun.tools.java.Environment;
  6.  
  7. final class NumberConstantData extends ConstantPoolData {
  8.    Number num;
  9.  
  10.    NumberConstantData(ConstantPool var1, Number var2) {
  11.       this.num = var2;
  12.    }
  13.  
  14.    void write(Environment var1, DataOutputStream var2, ConstantPool var3) throws IOException {
  15.       if (this.num instanceof Integer) {
  16.          var2.writeByte(3);
  17.          var2.writeInt(this.num.intValue());
  18.       } else if (this.num instanceof Long) {
  19.          var2.writeByte(5);
  20.          var2.writeLong(this.num.longValue());
  21.       } else if (this.num instanceof Float) {
  22.          var2.writeByte(4);
  23.          var2.writeFloat(this.num.floatValue());
  24.       } else {
  25.          if (this.num instanceof Double) {
  26.             var2.writeByte(6);
  27.             var2.writeDouble(this.num.doubleValue());
  28.          }
  29.  
  30.       }
  31.    }
  32.  
  33.    int order() {
  34.       return this.width() == 1 ? 0 : 3;
  35.    }
  36.  
  37.    int width() {
  38.       return !(this.num instanceof Double) && !(this.num instanceof Long) ? 1 : 2;
  39.    }
  40. }
  41.