01: /* NopOperator Copyright (C) 1998-2002 Jochen Hoenicke.
02: *
03: * This program is free software; you can redistribute it and/or modify
04: * it under the terms of the GNU Lesser General Public License as published by
05: * the Free Software Foundation; either version 2, or (at your option)
06: * any later version.
07: *
08: * This program is distributed in the hope that it will be useful,
09: * 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: NopOperator.java,v 2.15.4.1 2002/05/28 17:34:06 hoenicke Exp $
18: */
19:
20: package jode.expr;
21:
22: import jode.type.Type;
23: import jode.decompiler.TabbedPrintWriter;
24:
25: /**
26: * A NopOperator takes one arguments and returns it again. It is used
27: * as placeholder when the real operator is not yet known (e.g. in
28: * SwitchBlock, but also in every other Operator).
29: *
30: * A Nop operator doesn't have subExpressions; getSubExpressions() simply
31: * returns zero.
32: *
33: * @author Jochen Hoenicke */
34: public class NopOperator extends Expression {
35: public NopOperator(Type type) {
36: super (type);
37: }
38:
39: public int getFreeOperandCount() {
40: return 1;
41: }
42:
43: public int getPriority() {
44: return 1000;
45: }
46:
47: public void updateSubTypes() {
48: }
49:
50: public void updateType() {
51: }
52:
53: public Expression addOperand(Expression op) {
54: op.setType(type);
55: op.parent = parent;
56: return op;
57: }
58:
59: public boolean isConstant() {
60: return false;
61: }
62:
63: public boolean equals(Object o) {
64: return (o instanceof NopOperator);
65: }
66:
67: public Expression simplify() {
68: return this ;
69: }
70:
71: public void dumpExpression(TabbedPrintWriter writer)
72: throws java.io.IOException {
73: writer.print("POP");
74: }
75: }
|