blob: 60736b9b32439df2d2bfbfcc7c2918526ceda931 [file] [log] [blame]
alshabib339a3d92014-09-26 17:54:32 -07001package org.onlab.onos.store.topology.impl;
2
3import org.onlab.onos.net.DeviceId;
4
5import java.util.Objects;
6
7/**
8 * Key for filing pre-computed paths between source and destination devices.
9 */
10class PathKey {
11 private final DeviceId src;
12 private final DeviceId dst;
13
14 /**
15 * Creates a path key from the given source/dest pair.
16 * @param src source device
17 * @param dst destination device
18 */
19 PathKey(DeviceId src, DeviceId dst) {
20 this.src = src;
21 this.dst = dst;
22 }
23
24 @Override
25 public int hashCode() {
26 return Objects.hash(src, dst);
27 }
28
29 @Override
30 public boolean equals(Object obj) {
31 if (this == obj) {
32 return true;
33 }
34 if (obj instanceof PathKey) {
35 final PathKey other = (PathKey) obj;
36 return Objects.equals(this.src, other.src) && Objects.equals(this.dst, other.dst);
37 }
38 return false;
39 }
40}