blob: 22673a630df3e3acc19eb01c53304f02d09d368f [file] [log] [blame]
tomb36046e2014-08-27 00:22:24 -07001package org.onlab.onos.net;
2
tombb58c202014-09-07 22:51:50 -07003import java.util.Objects;
4
tomb36046e2014-08-27 00:22:24 -07005/**
6 * Representation of a network edge location where an end-station host is
7 * connected.
8 */
tombb58c202014-09-07 22:51:50 -07009public class HostLocation extends ConnectPoint {
10
11 private final long time;
12
13 public HostLocation(DeviceId deviceId, PortNumber portNumber, long time) {
14 super(deviceId, portNumber);
15 this.time = time;
16 }
tomb36046e2014-08-27 00:22:24 -070017
18 /**
19 * Returns the timestamp when the location was established, given in
20 * milliseconds since start of epoch.
21 *
22 * @return timestamp in milliseconds since start of epoch
23 */
tombb58c202014-09-07 22:51:50 -070024 public long time() {
25 return time;
26 }
27
28 @Override
29 public int hashCode() {
30 return 31 * super.hashCode() + Objects.hash(time);
31 }
32
33 @Override
34 public boolean equals(Object obj) {
35 if (obj instanceof HostLocation) {
36 final HostLocation other = (HostLocation) obj;
37 return super.equals(obj) && Objects.equals(this.time, other.time);
38 }
39 return false;
40 }
tomb36046e2014-08-27 00:22:24 -070041
42}