01: /* Soot - a J*va Optimization Framework
02: * Copyright (C) 2007 Manu Sridharan
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: package soot.jimple.spark.ondemand;
20:
21: import soot.jimple.spark.ondemand.genericutil.ImmutableStack;
22: import soot.jimple.spark.pag.AllocNode;
23:
24: public class AllocAndContext {
25:
26: public final AllocNode alloc;
27:
28: public final ImmutableStack<Integer> context;
29:
30: public AllocAndContext(AllocNode alloc,
31: ImmutableStack<Integer> context) {
32: this .alloc = alloc;
33: this .context = context;
34: }
35:
36: public String toString() {
37: return alloc + ", context " + context;
38: }
39:
40: public int hashCode() {
41: final int PRIME = 31;
42: int result = 1;
43: result = PRIME * result + alloc.hashCode();
44: result = PRIME * result + context.hashCode();
45: return result;
46: }
47:
48: public boolean equals(Object obj) {
49: if (this == obj)
50: return true;
51: if (obj == null)
52: return false;
53: if (getClass() != obj.getClass())
54: return false;
55: final AllocAndContext other = (AllocAndContext) obj;
56: if (!alloc.equals(other.alloc))
57: return false;
58: if (!context.equals(other.context))
59: return false;
60: return true;
61: }
62: }
|