5220428199c41920b50d2fcbc676e98ea52f3959
[controller.git] / opendaylight / forwardingrulesmanager / implementation / src / main / java / org / opendaylight / controller / forwardingrulesmanager / implementation / data / FlowEntryDistributionOrder.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8
9 /**
10  * Class used by the FRM to distribute the forwarding rules programming in the
11  * cluster and to collect back the results of the programming
12  */
13 package org.opendaylight.controller.forwardingrulesmanager.implementation.data;
14
15 import java.io.Serializable;
16 import java.net.InetAddress;
17
18 import org.opendaylight.controller.forwardingrulesmanager.FlowEntryInstall;
19 import org.opendaylight.controller.sal.core.UpdateType;
20
21 /**
22  * Class used by the FRM to distribute the forwarding rules programming in the
23  * cluster and to collect back the results of the programming
24  */
25 public final class FlowEntryDistributionOrder implements Serializable {
26     /**
27      * Serialization UID
28      */
29     private static final long serialVersionUID = 416280377113255147L;
30     final private FlowEntryInstall entry;
31     final private UpdateType upType;
32     final private InetAddress requestorController;
33
34     /**
35      * @return the entry
36      */
37     public FlowEntryInstall getEntry() {
38         return entry;
39     }
40
41     /**
42      * @return the upType
43      */
44     public UpdateType getUpType() {
45         return upType;
46     }
47
48     /**
49      * @return the requestorController
50      */
51     public InetAddress getRequestorController() {
52         return requestorController;
53     }
54
55     /**
56      * @param entry
57      *            FlowEntryInstall key value
58      * @param upType
59      *            UpdateType key value
60      * @param requestorController
61      *            identifier of the controller that initiated the request
62      */
63
64     public FlowEntryDistributionOrder(FlowEntryInstall entry, UpdateType upType, InetAddress requestorController) {
65         super();
66         this.entry = entry;
67         this.upType = upType;
68         this.requestorController = requestorController;
69     }
70
71     /*
72      * (non-Javadoc)
73      *
74      * @see java.lang.Object#hashCode()
75      */
76     @Override
77     public int hashCode() {
78         final int prime = 31;
79         int result = 1;
80         result = (prime * result) + ((entry == null) ? 0 : entry.hashCode());
81         result = (prime * result) + ((requestorController == null) ? 0 : requestorController.hashCode());
82         result = (prime * result) + ((upType == null) ? 0 : upType.hashCode());
83         return result;
84     }
85
86     /*
87      * (non-Javadoc)
88      *
89      * @see java.lang.Object#equals(java.lang.Object)
90      */
91     @Override
92     public boolean equals(Object obj) {
93         if (this == obj) {
94             return true;
95         }
96         if (obj == null) {
97             return false;
98         }
99         if (!(obj instanceof FlowEntryDistributionOrder)) {
100             return false;
101         }
102         FlowEntryDistributionOrder other = (FlowEntryDistributionOrder) obj;
103         if (entry == null) {
104             if (other.entry != null) {
105                 return false;
106             }
107         } else if (!entry.equals(other.entry)) {
108             return false;
109         }
110         if (requestorController == null) {
111             if (other.requestorController != null) {
112                 return false;
113             }
114         } else if (!requestorController.equals(other.requestorController)) {
115             return false;
116         }
117         if (upType != other.upType) {
118             return false;
119         }
120         return true;
121     }
122
123     /*
124      * (non-Javadoc)
125      *
126      * @see java.lang.Object#toString()
127      */
128     @Override
129     public String toString() {
130         StringBuilder builder = new StringBuilder();
131         builder.append("FlowEntryDistributionOrder [");
132         if (entry != null) {
133             builder.append("entry=")
134                     .append(entry)
135                     .append(", ");
136         }
137         if (upType != null) {
138             builder.append("upType=")
139                     .append(upType)
140                     .append(", ");
141         }
142         if (requestorController != null) {
143             builder.append("requestorController=")
144                     .append(requestorController);
145         }
146         builder.append("]");
147         return builder.toString();
148     }
149 }