blob: c7c44cb08d1bc7175575502e5d41d527c6511b89 [file] [log] [blame]
Ayaka Koshibe414196d2014-09-17 13:46:43 -07001package org.onlab.onos.net.flow;
2
alshabiba7f7ca82014-09-22 11:41:23 -07003import com.google.common.base.Objects;
4
Ayaka Koshibe414196d2014-09-17 13:46:43 -07005/**
6 * Representation of a Flow ID.
7 */
8public final class FlowId {
9
alshabiba7f7ca82014-09-22 11:41:23 -070010 private final long flowid;
Ayaka Koshibe414196d2014-09-17 13:46:43 -070011
alshabiba7f7ca82014-09-22 11:41:23 -070012 private FlowId(long id) {
Ayaka Koshibe414196d2014-09-17 13:46:43 -070013 this.flowid = id;
14 }
15
Ayaka Koshibe548891f2014-09-17 13:57:00 -070016 public static FlowId valueOf(int id) {
Ayaka Koshibe414196d2014-09-17 13:46:43 -070017 return new FlowId(id);
18 }
19
alshabiba7f7ca82014-09-22 11:41:23 -070020 public long value() {
Ayaka Koshibe414196d2014-09-17 13:46:43 -070021 return flowid;
22 }
alshabiba7f7ca82014-09-22 11:41:23 -070023
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 Koshibe414196d2014-09-17 13:46:43 -070040}