blob: 7fcb2e65799b5c1f0b340137a4b4643b3ab90204 [file] [log] [blame]
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08001package net.floodlightcontroller.util;
2
3import net.floodlightcontroller.util.CallerId;
4import net.floodlightcontroller.util.DataPath;
5import net.floodlightcontroller.util.FlowId;
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08006
7import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08008
9/**
10 * The class representing the Flow Path.
11 */
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070012public class FlowPath implements Comparable<FlowPath> {
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080013 private FlowId flowId; // The Flow ID
14 private CallerId installerId; // The Caller ID of the path installer
15 private DataPath dataPath; // The data path
16
17 /**
18 * Default constructor.
19 */
20 public FlowPath() {
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080021 dataPath = new DataPath();
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080022 }
23
24 /**
25 * Get the flow path Flow ID.
26 *
27 * @return the flow path Flow ID.
28 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080029 @JsonProperty("flowId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080030 public FlowId flowId() { return flowId; }
31
32 /**
33 * Set the flow path Flow ID.
34 *
35 * @param flowId the flow path Flow ID to set.
36 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080037 @JsonProperty("flowId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080038 public void setFlowId(FlowId flowId) {
39 this.flowId = flowId;
40 }
41
42 /**
43 * Get the Caller ID of the flow path installer.
44 *
45 * @return the Caller ID of the flow path installer.
46 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080047 @JsonProperty("installerId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080048 public CallerId installerId() { return installerId; }
49
50 /**
51 * Set the Caller ID of the flow path installer.
52 *
53 * @param installerId the Caller ID of the flow path installer.
54 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080055 @JsonProperty("installerId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080056 public void setInstallerId(CallerId installerId) {
57 this.installerId = installerId;
58 }
59
60 /**
61 * Get the flow path's data path.
62 *
63 * @return the flow path's data path.
64 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080065 @JsonProperty("dataPath")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080066 public DataPath dataPath() { return dataPath; }
67
68 /**
69 * Set the flow path's data path.
70 *
71 * @param dataPath the flow path's data path to set.
72 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080073 @JsonProperty("dataPath")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080074 public void setDataPath(DataPath dataPath) {
75 this.dataPath = dataPath;
76 }
77
78 /**
79 * Convert the flow path to a string.
80 *
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080081 * The string has the following form:
82 * [flowId=XXX installerId=XXX dataPath=XXX]
83 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080084 * @return the flow path as a string.
85 */
86 @Override
87 public String toString() {
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -080088 String ret = "[flowId=" + this.flowId.toString();
89 ret += " installerId=" + this.installerId.toString();
90 ret += " dataPath=" + this.dataPath.toString();
91 ret += "]";
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080092 return ret;
93 }
Umesh Krishnaswamy57a32a92013-03-21 14:21:15 -070094
95 /**
96 * CompareTo method to order flowPath by Id
97 */
98 @Override
99 public int compareTo(FlowPath f) {
100 return (int) (this.flowId.value() - f.flowId.value());
101 }
102
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800103}