KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > tonicsystems > jarjar > Pair


1 /*
2   Jar Jar Links - A utility to repackage and embed Java libraries
3   Copyright (C) 2004 Tonic Systems, Inc.
4
5   This program is free software; you can redistribute it and/or modify
6   it under the terms of the GNU General Public License as published by
7   the Free Software Foundation; either version 2 of the License, or
8   (at your option) any later version.
9
10   This program is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13   GNU General Public License for more details.
14
15   You should have received a copy of the GNU General Public License
16   along with this program; see the file COPYING. if not, write to
17   the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18   Boston, MA 02111-1307 USA
19 */

20
21 package com.tonicsystems.jarjar;
22
23 class Pair
24 {
25     private Object JavaDoc o1;
26     private Object JavaDoc o2;
27         
28     public Pair(Object JavaDoc o1, Object JavaDoc o2) {
29         this.o1 = o1;
30         this.o2 = o2;
31     }
32
33     public Object JavaDoc getObject1() {
34         return o1;
35     }
36
37     public Object JavaDoc getObject2() {
38         return o2;
39     }
40
41     public int hashCode() {
42         return o1.hashCode() ^ o2.hashCode();
43     }
44
45     public boolean equals(Object JavaDoc o) {
46         if (o == null)
47             return false;
48         if (!(o instanceof Pair))
49             return false;
50         Pair other = (Pair)o;
51         return o1.equals(other.o1) && o2.equals(other.o2);
52     }
53 }
54
Popular Tags