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 | } | ||||
Yuta HIGUCHI | adcafb6 | 2014-10-04 22:35:15 -0700 | [diff] [blame] | 29 | if (obj == null) { |
30 | return false; | ||||
31 | } | ||||
alshabib | a7f7ca8 | 2014-09-22 11:41:23 -0700 | [diff] [blame] | 32 | if (obj.getClass() == this.getClass()) { |
33 | FlowId that = (FlowId) obj; | ||||
34 | return Objects.equal(this.flowid, that.flowid); | ||||
35 | } | ||||
36 | return false; | ||||
37 | } | ||||
38 | |||||
39 | @Override | ||||
40 | public int hashCode() { | ||||
41 | return Objects.hashCode(this.flowid); | ||||
42 | } | ||||
Ayaka Koshibe | 414196d | 2014-09-17 13:46:43 -0700 | [diff] [blame] | 43 | } |