01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 1999 Patrick Lam
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library 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 GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the
16: * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17: * Boston, MA 02111-1307, USA.
18: */
19:
20: /*
21: * Modified by the Sable Research Group and others 1997-1999.
22: * See the 'credits' file distributed with Soot for the complete list of
23: * contributors. (Soot is distributed at http://www.sable.mcgill.ca/soot)
24: */
25:
26: package soot.jimple.internal;
27:
28: import soot.*;
29: import soot.jimple.*;
30: import soot.util.*;
31: import java.util.*;
32:
33: public abstract class AbstractNewExpr implements NewExpr {
34: RefType type;
35:
36: public boolean equivTo(Object o) {
37: if (o instanceof AbstractNewExpr) {
38: AbstractNewExpr ae = (AbstractNewExpr) o;
39: return type.equals(ae.type);
40: }
41: return false;
42: }
43:
44: /** Returns a hash code for this object, consistent with structural equality. */
45: public int equivHashCode() {
46: return type.hashCode();
47: }
48:
49: public abstract Object clone();
50:
51: public String toString() {
52: return Jimple.NEW + " " + type.toString();
53: }
54:
55: public void toString(UnitPrinter up) {
56: up.literal(Jimple.NEW);
57: up.literal(" ");
58: up.type(type);
59: }
60:
61: public RefType getBaseType() {
62: return type;
63: }
64:
65: public void setBaseType(RefType type) {
66: this .type = type;
67: }
68:
69: public Type getType() {
70: return type;
71: }
72:
73: public List getUseBoxes() {
74: return AbstractUnit.emptyList;
75: }
76:
77: public void apply(Switch sw) {
78: ((ExprSwitch) sw).caseNewExpr(this);
79: }
80: }
|