1 package serp.bytecode.lowlevel;
2
3 import java.io.*;
4
5 import serp.bytecode.visitor.*;
6 import serp.util.*;
7
8
9
10
11
12
13 public class IntEntry extends Entry implements ConstantEntry {
14 private int _value = -1;
15
16
17
18
19 public IntEntry() {
20 }
21
22
23
24
25
26
27 public IntEntry(int value) {
28 _value = value;
29 }
30
31 public int getType() {
32 return Entry.INT;
33 }
34
35
36
37
38 public int getValue() {
39 return _value;
40 }
41
42
43
44
45 public void setValue(int value) {
46 Object key = beforeModify();
47 _value = value;
48 afterModify(key);
49 }
50
51 public Object getConstant() {
52 return Numbers.valueOf(getValue());
53 }
54
55 public void setConstant(Object value) {
56 setValue(((Number) value).intValue());
57 }
58
59 protected void readData(DataInput in) throws IOException {
60 _value = in.readInt();
61 }
62
63 protected void writeData(DataOutput out) throws IOException {
64 out.writeInt(_value);
65 }
66
67 public void acceptVisit(BCVisitor visit) {
68 visit.enterIntEntry(this);
69 visit.exitIntEntry(this);
70 }
71 }