KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jode > expr > LocalVarOperator


1 /* LocalVarOperator 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: LocalVarOperator.java.in,v 4.1.2.1 2002/05/28 17:34:06 hoenicke Exp $
18  */

19
20 package jode.expr;
21 import jode.GlobalOptions;
22 import jode.type.Type;
23 import jode.decompiler.LocalInfo;
24 import jode.decompiler.TabbedPrintWriter;
25
26 import java.util.Collection JavaDoc;
27
28 public abstract class LocalVarOperator extends Operator {
29     LocalInfo local;
30
31     public LocalVarOperator(Type lvalueType, LocalInfo local) {
32         super(lvalueType);
33         this.local = local;
34         local.setOperator(this);
35     initOperands(0);
36     }
37
38     public abstract boolean isRead();
39     public abstract boolean isWrite();
40
41     public void updateSubTypes() {
42     if (parent != null
43         && (GlobalOptions.debuggingFlags & GlobalOptions.DEBUG_TYPES) != 0)
44         GlobalOptions.err.println("local type changed in: "+parent);
45         local.setType(type);
46     }
47
48     public void updateType() {
49     updateParentType(local.getType());
50     }
51
52     public void fillDeclarables(Collection JavaDoc used) {
53     used.add(local);
54     super.fillDeclarables(used);
55     }
56
57     public LocalInfo getLocalInfo() {
58     return local.getLocalInfo();
59     }
60
61     public void setLocalInfo(LocalInfo newLocal) {
62     local = newLocal;
63     updateType();
64     }
65
66     public int getPriority() {
67         return 1000;
68     }
69
70     public void dumpExpression(TabbedPrintWriter writer) {
71     writer.print(local.getName());
72     }
73 }
74
Popular Tags