KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jode > expr > PopOperator


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

19
20 package jode.expr;
21 import jode.type.Type;
22 import jode.decompiler.TabbedPrintWriter;
23
24 public class PopOperator extends Operator {
25
26     Type popType;
27
28     public PopOperator(Type argtype) {
29         super(Type.tVoid, 0);
30     popType = argtype;
31     initOperands(1);
32     }
33
34     public int getPriority() {
35         return 0;
36     }
37
38     public void updateSubTypes() {
39     subExpressions[0].setType(Type.tSubType(popType));
40     }
41     public void updateType() {
42     }
43
44     public int getBreakPenalty() {
45     if (subExpressions[0] instanceof Operator)
46         return ((Operator) subExpressions[0]).getBreakPenalty();
47     return 0;
48     }
49     
50     public void dumpExpression(TabbedPrintWriter writer)
51     throws java.io.IOException JavaDoc {
52     /* Don't give a priority; we can't allow parens around
53      * a statement.
54      */

55     subExpressions[0].dumpExpression(writer);
56     }
57 }
58
Popular Tags