tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.trivial.topology.impl; |
| 2 | |
| 3 | import org.onlab.onos.net.DeviceId; |
| 4 | |
| 5 | import java.util.Objects; |
| 6 | |
| 7 | /** |
tom | 578ebdc | 2014-09-11 11:12:51 -0700 | [diff] [blame^] | 8 | * Key for filing pre-computed paths between source and destination devices. |
tom | 9793755 | 2014-09-11 10:48:42 -0700 | [diff] [blame] | 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 (obj instanceof PathKey) { |
| 32 | final PathKey other = (PathKey) obj; |
| 33 | return Objects.equals(this.src, other.src) && Objects.equals(this.dst, other.dst); |
| 34 | } |
| 35 | return false; |
| 36 | } |
| 37 | } |