blob: 52eac0a41a7ab33995b38724b1b7020f6933101b [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
alshabib9290eea2014-09-22 11:58:17 -070016 public static FlowId valueOf(long 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 }
Yuta HIGUCHIadcafb62014-10-04 22:35:15 -070029 if (obj == null) {
30 return false;
31 }
alshabiba7f7ca82014-09-22 11:41:23 -070032 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 Koshibe414196d2014-09-17 13:46:43 -070043}