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:
20: package soot.jimple.spark.ondemand.genericutil;
21:
22: /**
23: * A mutable pair of objects.
24: *
25: * @author manu
26: *
27: */
28: public class MutablePair<T, U> {
29:
30: public MutablePair(T o1, U o2) {
31: this .o1 = o1;
32: this .o2 = o2;
33: }
34:
35: public int hashCode() {
36: return o1.hashCode() + o2.hashCode();
37: }
38:
39: public boolean equals(Object other) {
40: if (other instanceof MutablePair) {
41: MutablePair p = (MutablePair) other;
42: return o1.equals(p.o1) && o2.equals(p.o2);
43: } else
44: return false;
45: }
46:
47: public String toString() {
48: return "Pair " + o1 + "," + o2;
49: }
50:
51: public T getO1() {
52: return o1;
53: }
54:
55: public U getO2() {
56: return o2;
57: }
58:
59: private T o1;
60:
61: private U o2;
62:
63: public void setO1(T o1) {
64: this .o1 = o1;
65: }
66:
67: public void setO2(U o2) {
68: this.o2 = o2;
69: }
70:
71: }
|