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