alshabib | 339a3d9 | 2014-09-26 17:54:32 -0700 | [diff] [blame] | 1 | package org.onlab.onos.store.topology.impl; |
| 2 | |
| 3 | import org.onlab.onos.net.DeviceId; |
| 4 | |
| 5 | import java.util.Objects; |
| 6 | |
| 7 | /** |
| 8 | * Key for filing pre-computed paths between source and destination devices. |
| 9 | */ |
| 10 | class 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 | } |