1 package serp.bytecode.lowlevel;
2
3 import java.io.*;
4
5
6
7
8
9
10
11
12
13 public abstract class ComplexEntry extends Entry {
14 private int _classIndex = 0;
15 private int _nameAndTypeIndex = 0;
16
17
18
19
20 public ComplexEntry() {
21 }
22
23
24
25
26
27
28
29
30
31 public ComplexEntry(int classIndex, int nameAndTypeIndex) {
32 _classIndex = classIndex;
33 _nameAndTypeIndex = nameAndTypeIndex;
34 }
35
36
37
38
39
40 public int getClassIndex() {
41 return _classIndex;
42 }
43
44
45
46
47
48 public void setClassIndex(int classIndex) {
49 Object key = beforeModify();
50 _classIndex = classIndex;
51 afterModify(key);
52 }
53
54
55
56
57
58 public ClassEntry getClassEntry() {
59 return (ClassEntry) getPool().getEntry(_classIndex);
60 }
61
62
63
64
65
66 public int getNameAndTypeIndex() {
67 return _nameAndTypeIndex;
68 }
69
70
71
72
73
74 public void setNameAndTypeIndex(int nameAndTypeIndex) {
75 Object key = beforeModify();
76 _nameAndTypeIndex = nameAndTypeIndex;
77 afterModify(key);
78 }
79
80
81
82
83
84 public NameAndTypeEntry getNameAndTypeEntry() {
85 return (NameAndTypeEntry) getPool().getEntry(_nameAndTypeIndex);
86 }
87
88 void readData(DataInput in) throws IOException {
89 _classIndex = in.readUnsignedShort();
90 _nameAndTypeIndex = in.readUnsignedShort();
91 }
92
93 void writeData(DataOutput out) throws IOException {
94 out.writeShort(_classIndex);
95 out.writeShort(_nameAndTypeIndex);
96 }
97 }