blob: ea993a4fcd73cd72260ff6d504749cec639a3576 [file] [log] [blame]
tom97937552014-09-11 10:48:42 -07001package org.onlab.onos.net.trivial.topology.impl;
2
3import org.onlab.onos.net.DeviceId;
4
5import java.util.Objects;
6
7/**
tom578ebdc2014-09-11 11:12:51 -07008 * Key for filing pre-computed paths between source and destination devices.
tom97937552014-09-11 10:48:42 -07009 */
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 (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}