1
2
3
4 package joeq.Class;
5
6 import joeq.Runtime.TypeCheck;
7
8
9
10
11
12 public class jq_TryCatchBC {
13
14
15 private char startPC, endPC, handlerPC;
16 private jq_Class exType;
17
18 public jq_TryCatchBC(char startPC, char endPC, char handlerPC, jq_Class exType) {
19 this.startPC = startPC;
20 this.endPC = endPC;
21 this.handlerPC = handlerPC;
22 this.exType = exType;
23 }
24
25 public boolean catches(int pc, jq_Class t) {
26 t.prepare();
27 if (pc < startPC) return false;
28 if (pc >= endPC) return false;
29 if (exType != null && !TypeCheck.isAssignable(t, exType)) return false;
30 return true;
31 }
32
33 public char getStartPC() { return startPC; }
34 public char getEndPC() { return endPC; }
35 public char getHandlerPC() { return handlerPC; }
36 public jq_Class getExceptionType() { return exType; }
37
38 public String toString() {
39 return "(start="+(int)startPC+",end="+(int)endPC+",handler="+(int)handlerPC+",type="+exType+")";
40 }
41 }