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 / ConstantPoolEntry.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-03-12  |  1.7 KB  |  67 lines

  1. package sunw.demo.classfile;
  2.  
  3. import java.io.DataOutputStream;
  4. import java.io.IOException;
  5.  
  6. abstract class ConstantPoolEntry {
  7.    static final byte CONSTANT_UTF8 = 1;
  8.    static final byte CONSTANT_UNICODE = 2;
  9.    static final byte CONSTANT_INTEGER = 3;
  10.    static final byte CONSTANT_FLOAT = 4;
  11.    static final byte CONSTANT_LONG = 5;
  12.    static final byte CONSTANT_DOUBLE = 6;
  13.    static final byte CONSTANT_CLASS = 7;
  14.    static final byte CONSTANT_STRING = 8;
  15.    static final byte CONSTANT_FIELDREF = 9;
  16.    static final byte CONSTANT_METHODREF = 10;
  17.    static final byte CONSTANT_INTERFACEMETHODREF = 11;
  18.    static final byte CONSTANT_NAMEANDTYPE = 12;
  19.    private byte tag;
  20.    private ClassFile classFile;
  21.    private short index = -1;
  22.  
  23.    ConstantPoolEntry(byte var1, ClassFile var2) {
  24.       this.tag = var1;
  25.       this.classFile = var2;
  26.    }
  27.  
  28.    ConstantPoolEntry(byte var1, ClassFile var2, short var3) {
  29.       this.tag = var1;
  30.       this.classFile = var2;
  31.       this.index = var3;
  32.    }
  33.  
  34.    protected void addToConstantPool() {
  35.       if (this.index == -1) {
  36.          this.index = this.classFile.addConstantPoolEntry(this);
  37.       }
  38.  
  39.    }
  40.  
  41.    protected static boolean debug() {
  42.       return ClassFile.debug();
  43.    }
  44.  
  45.    public abstract boolean equals(Object var1);
  46.  
  47.    ClassFile getClassFile() {
  48.       return this.classFile;
  49.    }
  50.  
  51.    short getConstantPoolIndex() {
  52.       if (this.index == -1) {
  53.          this.index = this.classFile.addConstantPoolEntry(this);
  54.       }
  55.  
  56.       return this.index;
  57.    }
  58.  
  59.    byte getTag() {
  60.       return this.tag;
  61.    }
  62.  
  63.    public abstract int hashCode();
  64.  
  65.    abstract void write(DataOutputStream var1) throws IOException;
  66. }
  67.