KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jode > decompiler > LocalVariableTable


1 /* LocalVariableTable Copyright (C) 1998-2002 Jochen Hoenicke.
2  *
3  * This program is free software; you can redistribute it and/or modify
4  * it under the terms of the GNU Lesser General Public License as published by
5  * the Free Software Foundation; either version 2, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program; see the file COPYING.LESSER. If not, write to
15  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
16  *
17  * $Id: LocalVariableTable.java,v 4.14.2.1 2002/05/28 17:34:03 hoenicke Exp $
18  */

19
20 package jode.decompiler;
21 import jode.type.Type;
22 import jode.bytecode.LocalVariableInfo;
23
24 public class LocalVariableTable {
25     LocalVariableRangeList[] locals;
26
27     public LocalVariableTable(int maxLocals, LocalVariableInfo[] lvt) {
28         locals = new LocalVariableRangeList[maxLocals];
29         for (int i=0; i < maxLocals; i++)
30             locals[i] = new LocalVariableRangeList();
31
32     for (int i=0; i<lvt.length; i++)
33         locals[lvt[i].slot].addLocal(lvt[i].start.getAddr(),
34                      lvt[i].end.getAddr(),
35                      lvt[i].name, Type.tType(lvt[i].type));
36     }
37
38     public LocalVarEntry getLocal(int slot, int addr)
39          throws ArrayIndexOutOfBoundsException JavaDoc
40     {
41         return locals[slot].getInfo(addr);
42     }
43 }
44
Popular Tags