1 package org.lcsim.recon.tracking.trfutil;
2 import java.util.*;
3
4
5
6
7
8 public class Pair
9 {
10
11 private Object _first;
12 private Object _second;
13
14
15
16
17
18
19
20 public Pair( Object first, Object second )
21 {
22 _first = first;
23 _second = second;
24 }
25
26
27
28
29
30
31 public Object first()
32 {
33 return _first;
34 }
35
36
37
38
39
40
41
42 public Object second()
43 {
44 return _second;
45 }
46
47
48
49
50
51
52
53 public boolean equals( Object o )
54 {
55 if ( o != null && o.getClass().equals(getClass()) )
56 {
57 return _first.equals(((Pair) o).first()) && _second.equals(((Pair)o).second());
58 }
59 return false;
60 }
61
62
63
64
65
66
67
68
69 public boolean notEquals( Object o )
70 {
71 return !equals(o);
72 }
73
74
75
76
77
78
79 public int hashCode()
80 {
81 int result = 17;
82 result = 37*result + _first.hashCode();
83 result = 37*result +_second.hashCode();
84 return result;
85 }
86
87
88
89
90
91
92
93
94 public String toString()
95 {
96 String className = getClass().getName();
97 int lastDot = className.lastIndexOf('.');
98 if(lastDot!=-1)className = className.substring(lastDot+1);
99
100 return className+" ( "+_first+", "+_second+" )";
101 }
102 }