1
2
3
4 package joeq.Class;
5
6
7
8
9
10 public class jq_LocalVarTableEntry implements Comparable {
11
12 private char startPC;
13 private char length;
14 private jq_NameAndDesc nd;
15 private char index;
16
17 jq_LocalVarTableEntry(char startPC, char index) {
18 this.startPC = startPC;
19 this.index = index;
20 }
21
22 public jq_LocalVarTableEntry(char startPC, char length,
23 jq_NameAndDesc nd, char index) {
24 this.startPC = startPC;
25 this.length = length;
26 this.nd = nd;
27 this.index = index;
28 }
29
30 public char getStartPC() { return startPC; }
31 public char getLength() { return length; }
32 public jq_NameAndDesc getNameAndDesc() { return nd; }
33 public char getIndex() { return index; }
34
35 boolean isInRange(int bci, int index) {
36 return this.index == index && startPC <= bci && bci < startPC + length;
37 }
38
39 public int compareTo(jq_LocalVarTableEntry that) {
40 if (this.equals(that)) return 0;
41 if (this.index < that.index) return -1;
42 if (this.index > that.index) return 1;
43 if (this.startPC < that.startPC) return -1;
44 return 1;
45 }
46 public int compareTo(Object that) {
47 return compareTo((jq_LocalVarTableEntry)that);
48 }
49
50 public boolean equals(jq_LocalVarTableEntry that) {
51 return this.startPC == that.startPC && this.index == that.index;
52 }
53 public boolean equals(Object that) {
54 return equals((jq_LocalVarTableEntry)that);
55 }
56 public int hashCode() {
57 return (startPC << 8) | index;
58 }
59
60 public String toString() {
61 return "(startPC="+(int)startPC+",length="+(int)length
62 +",nd="+nd+",index="+(int)index+")";
63 }
64 }