1   /*
2    *  Pair.java
3    *
4    *  Copyright (c) 1998-2001, 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.2 2001/09/17 12:21:01 valyt Exp $
14   */
15  
16  
17  package gate.util;
18  
19  // Imports
20  import java.lang.String;
21  import java.lang.Object;
22  import java.io.Serializable;
23  
24  public class Pair implements Serializable {
25  
26    // Fields
27    public Object first;
28    public Object second;
29    static final long serialVersionUID = 3690756099267025454L;
30  
31    // Constructors
32    public Pair(Object p0, Object p1) { first = p0; second = p1;}
33    public Pair() { first = null; second = null;}
34    public Pair(Pair p0) {first = p0.first; second = p0.second; }
35  
36    // Methods
37    public int hashCode() { return first.hashCode() ^ second.hashCode(); }
38    public String toString() { return "<" + first.toString() +
39                                      ", " + second.toString() + ">" ;}
40    public boolean equals(Object p0) {
41      if (!p0.getClass().equals(this.getClass()))
42        return false;
43      return equals((Pair) p0);
44    }//equals
45    public boolean equals(Pair p0) {
46      if (p0.first.equals(first)&& p0.second.equals(second))
47        return true;
48      return false;
49    } //equals
50    public synchronized Object clone() { return new Pair(first, second); }
51  }