01: /*
02: * CatchBlock.java Copyright (c) 2006,07 Swaroop Belur
03: *
04: * This program is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU General Public License
06: * as published by the Free Software Foundation; either version 2
07: * of the License, or (at your option) any later version.
08:
09: * This program is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13:
14: * You should have received a copy of the GNU General Public License
15: * along with this program; if not, write to the Free Software
16: * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17: *
18: */
19:
20: package net.sf.jdec.blocks;
21:
22: /***
23: * Represents a catch block handler of one try/catch block in code
24: * @author sbelur
25: *
26: */
27: public class CatchBlock implements TryCatchFinally {
28:
29: private boolean useToFindLastCatchEnd = true;
30: private final java.lang.String type = "catch";
31: private TryBlock associatedTry = null;
32: private int start = -1;
33: private int end = -1;
34: private TryCatchFinally nextBlock = null;
35:
36: public void useMeForDeterminingTheEndOfLastCatch(boolean use) {
37: this .useToFindLastCatchEnd = use;
38: }
39:
40: public boolean isUsedForDeterminingTheEndOfLastCatch() {
41: return useToFindLastCatchEnd;
42: }
43:
44: public TryCatchFinally getNextBlock() {
45: return nextBlock;
46: }
47:
48: public void setNextBlock(TryCatchFinally nextBlock) {
49: this .nextBlock = nextBlock;
50: }
51:
52: public CatchBlock() {
53: super ();
54:
55: }
56:
57: public String getType() {
58:
59: return type;
60: }
61:
62: public TryBlock getAssociatedTry() {
63: return associatedTry;
64:
65: }
66:
67: public void setAssociatedTry(TryBlock associatedTry) {
68: this .associatedTry = associatedTry;
69: }
70:
71: public void setMyStart(int pos) {
72: start = pos;
73: }
74:
75: public int getStart() {
76: return start;
77: }
78:
79: public int getEnd() {
80: return end;
81: }
82:
83: public void setEnd(int end) {
84: this.end = end;
85: }
86:
87: }
|