01 /*
02 * Pair.java
03 *
04 * Copyright (c) 1995-2010, The University of Sheffield. See the file
05 * COPYRIGHT.txt in the software or at http://gate.ac.uk/gate/COPYRIGHT.txt
06 *
07 * This file is part of GATE (see http://gate.ac.uk/), and is free
08 * software, licenced under the GNU Library General Public License,
09 * Version 2, June 1991 (in the distribution as file licence.html,
10 * and also available at http://gate.ac.uk/gate/licence.html).
11 *
12 * Kalina Bontcheva, 13/Sept/2001
13 *
14 * $Id: Pair.java 12006 2009-12-01 17:24:28Z thomas_heitz $
15 */
16
17
18 package gate.util;
19
20 // Imports
21 import java.io.Serializable;
22
23 public class Pair implements Serializable {
24
25 // Fields
26 public Object first;
27 public Object second;
28 static final long serialVersionUID = 3690756099267025454L;
29
30 // Constructors
31 public Pair(Object p0, Object p1) { first = p0; second = p1;}
32 public Pair() { first = null; second = null;}
33 public Pair(Pair p0) {first = p0.first; second = p0.second; }
34
35 // Methods
36 public int hashCode() { return first.hashCode() ^ second.hashCode(); }
37 public String toString() { return "<" + first.toString() +
38 ", " + second.toString() + ">" ;}
39 public boolean equals(Object p0) {
40 if (!p0.getClass().equals(this.getClass()))
41 return false;
42 return equals((Pair) p0);
43 }//equals
44 public boolean equals(Pair p0) {
45 if (p0.first.equals(first)&& p0.second.equals(second))
46 return true;
47 return false;
48 } //equals
49 public synchronized Object clone() { return new Pair(first, second); }
50 }
|