blob: ff954a01aafe99975ece85a38ef0c690864c9a53 [file] [log] [blame]
Umesh Krishnaswamy345ee992012-12-13 20:29:48 -08001package net.floodlightcontroller.topology;
2
3public class NodePair {
4 private long min;
5 private long max;
6
7 public NodePair(long a, long b) {
8 if (a < b) {
9 min = a;
10 max = b;
11 } else {
12 min = b;
13 max = a;
14 }
15 }
16
17 public long getNode() {
18 return min;
19 }
20
21 public long getOtherNode() {
22 return max;
23 }
24
25 public String toString() {
26 return "[" + new Long(min) + ", " + new Long(max) + "]";
27 }
28
29 @Override
30 public int hashCode() {
31 final int prime = 31;
32 int result = 1;
33 result = prime * result + (int) (max ^ (max >>> 32));
34 result = prime * result + (int) (min ^ (min >>> 32));
35 return result;
36 }
37
38 @Override
39 public boolean equals(Object obj) {
40 if (this == obj)
41 return true;
42 if (obj == null)
43 return false;
44 if (getClass() != obj.getClass())
45 return false;
46 NodePair other = (NodePair) obj;
47 if (max != other.max)
48 return false;
49 if (min != other.min)
50 return false;
51 return true;
52 }
53}