blob: e3467322f4cece3b35983e46178f0830aa60d973 [file] [log] [blame]
Brian O'Connordee2e6b2014-08-12 11:34:51 -07001package net.onrc.onos.core.matchaction;
2
Ray Milkey9ed4b962014-08-20 15:43:40 -07003import java.util.Objects;
Ray Milkeyc127a5a2014-08-20 11:22:12 -07004
5/**
6 * Identifier for a MatchActionOperations object. This is an immutable class
7 * that encapsulates a globally unique identifier for the MatchActionOperations
8 * object.
9 */
10public final class MatchActionOperationsId {
11
Ray Milkey9ed4b962014-08-20 15:43:40 -070012 private final long id;
Ray Milkeyc127a5a2014-08-20 11:22:12 -070013
14 /**
Ray Milkey9ed4b962014-08-20 15:43:40 -070015 * Constructs an Operations identifier and from a unique identifier.
Ray Milkeyc127a5a2014-08-20 11:22:12 -070016 */
Ray Milkey9ed4b962014-08-20 15:43:40 -070017 public MatchActionOperationsId(final long newId) {
18 id = newId;
Ray Milkeyc127a5a2014-08-20 11:22:12 -070019 }
20
21 /**
22 * Gets the identifier for the Operations object.
23 *
24 * @return Operations object identifier as a string
25 */
Ray Milkey9ed4b962014-08-20 15:43:40 -070026 public long getId() {
Ray Milkeyc127a5a2014-08-20 11:22:12 -070027 return id;
28 }
29
30 @Override
31 public boolean equals(final Object other) {
32 if (other == this) {
33 return true;
34 }
35
36 if (!(other instanceof MatchActionOperationsId)) {
37 return false;
38 }
39
Ray Milkey9ed4b962014-08-20 15:43:40 -070040 final MatchActionOperationsId that = (MatchActionOperationsId) other;
Ray Milkeyc127a5a2014-08-20 11:22:12 -070041
Ray Milkey9ed4b962014-08-20 15:43:40 -070042 return this.getId() == that.getId();
Ray Milkeyc127a5a2014-08-20 11:22:12 -070043 }
44
45 @Override
46 public int hashCode() {
Ray Milkey9ed4b962014-08-20 15:43:40 -070047 return Objects.hashCode(id);
Ray Milkeyc127a5a2014-08-20 11:22:12 -070048 }
Brian O'Connordee2e6b2014-08-12 11:34:51 -070049}