00001 package de.fub.bytecode.classfile;
00002
00003 import de.fub.bytecode.Constants;
00004 import java.io.*;
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 public final class PMGClass extends Attribute {
00016 private int pmg_class_index, pmg_index;
00017
00018
00019
00020
00021
00022
00023
00024 public PMGClass(int name_index, int length, int pmg_index, int pmg_class_index,
00025 ConstantPool constant_pool)
00026 {
00027 super(Constants.ATTR_PMG, name_index, length, constant_pool);
00028 this.pmg_index = pmg_index;
00029 this.pmg_class_index = pmg_class_index;
00030 }
00031
00032
00033
00034
00035
00036
00037
00038
00039 PMGClass(int name_index, int length, DataInputStream file,
00040 ConstantPool constant_pool) throws IOException
00041 {
00042 this(name_index, length, file.readUnsignedShort(), file.readUnsignedShort(),
00043 constant_pool);
00044 }
00045
00046
00047
00048
00049 public PMGClass(PMGClass c) {
00050 this(c.getNameIndex(), c.getLength(), c.getPMGIndex(), c.getPMGClassIndex(),
00051 c.getConstantPool());
00052 }
00053
00054
00055
00056
00057
00058
00059
00060 public void accept(Visitor v) {
00061 System.err.println("Visiting non-standard PMGClass object");
00062 }
00063
00064
00065
00066 public Attribute copy(ConstantPool constant_pool) {
00067 return (PMGClass)clone();
00068 }
00069
00070
00071
00072
00073
00074
00075 public final void dump(DataOutputStream file) throws IOException
00076 {
00077 super.dump(file);
00078 file.writeShort(pmg_index);
00079 file.writeShort(pmg_class_index);
00080 }
00081
00082
00083
00084 public final int getPMGClassIndex() { return pmg_class_index; }
00085
00086
00087
00088 public final String getPMGClassName() {
00089 ConstantUtf8 c = (ConstantUtf8)constant_pool.getConstant(pmg_class_index,
00090 Constants.CONSTANT_Utf8);
00091 return c.getBytes();
00092 }
00093
00094
00095
00096 public final int getPMGIndex() { return pmg_index; }
00097
00098
00099
00100 public final String getPMGName() {
00101 ConstantUtf8 c = (ConstantUtf8)constant_pool.getConstant(pmg_index,
00102 Constants.CONSTANT_Utf8);
00103 return c.getBytes();
00104 }
00105
00106
00107
00108 public final void setPMGClassIndex(int pmg_class_index) {
00109 this.pmg_class_index = pmg_class_index;
00110 }
00111
00112
00113
00114 public final void setPMGIndex(int pmg_index) {
00115 this.pmg_index = pmg_index;
00116 }
00117
00118
00119
00120 public final String toString() {
00121 return "PMGClass(" + getPMGName() + ", " + getPMGClassName() + ")";
00122 }
00123 }