Brian O'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.matchaction; |
| 2 | |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 3 | import java.util.Objects; |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 4 | |
| 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 | */ |
| 10 | public final class MatchActionOperationsId { |
| 11 | |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 12 | private final long id; |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 13 | |
| 14 | /** |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 15 | * Constructs an Operations identifier and from a unique identifier. |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 16 | */ |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 17 | public MatchActionOperationsId(final long newId) { |
| 18 | id = newId; |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Gets the identifier for the Operations object. |
| 23 | * |
| 24 | * @return Operations object identifier as a string |
| 25 | */ |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 26 | public long getId() { |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 27 | 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 Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 40 | final MatchActionOperationsId that = (MatchActionOperationsId) other; |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 41 | |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 42 | return this.getId() == that.getId(); |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public int hashCode() { |
Ray Milkey | 9ed4b96 | 2014-08-20 15:43:40 -0700 | [diff] [blame^] | 47 | return Objects.hashCode(id); |
Ray Milkey | c127a5a | 2014-08-20 11:22:12 -0700 | [diff] [blame] | 48 | } |
Brian O'Connor | dee2e6b | 2014-08-12 11:34:51 -0700 | [diff] [blame] | 49 | } |