Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 1 | package org.onlab.onos.net.flow; |
| 2 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 3 | import com.google.common.base.Objects; |
| 4 | |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 5 | /** |
| 6 | * Representation of a Flow ID. |
| 7 | */ |
| 8 | public final class FlowId { |
| 9 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 10 | private final long flowid; |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 11 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 12 | private FlowId(long id) { |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 13 | this.flowid = id; |
| 14 | } |
| 15 | |
alshabib | 9290eea | 2014-09-22 11:58:17 -0700 | [diff] [blame^] | 16 | public static FlowId valueOf(long id) { |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 17 | return new FlowId(id); |
| 18 | } |
| 19 | |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 20 | public long value() { |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 21 | return flowid; |
| 22 | } |
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 23 | |
| 24 | @Override |
| 25 | public boolean equals(Object obj) { |
| 26 | if (this == obj) { |
| 27 | return true; |
| 28 | } |
| 29 | if (obj.getClass() == this.getClass()) { |
| 30 | FlowId that = (FlowId) obj; |
| 31 | return Objects.equal(this.flowid, that.flowid); |
| 32 | } |
| 33 | return false; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public int hashCode() { |
| 38 | return Objects.hashCode(this.flowid); |
| 39 | } |
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 40 | } |