Bug 1029: Remove dead code: samples/clustersession
[controller.git] / opendaylight / adsal / sal / api / src / main / java / org / opendaylight / controller / sal / reader / NodeConnectorStatistics.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 package org.opendaylight.controller.sal.reader;
10
11 import java.io.Serializable;
12
13 import javax.xml.bind.annotation.XmlAccessType;
14 import javax.xml.bind.annotation.XmlAccessorType;
15 import javax.xml.bind.annotation.XmlElement;
16 import javax.xml.bind.annotation.XmlRootElement;
17
18 import org.opendaylight.controller.sal.core.NodeConnector;
19
20 /**
21  * Represents the statistics for a node connector
22  */
23 @XmlRootElement
24 @XmlAccessorType(XmlAccessType.NONE)
25 public class NodeConnectorStatistics implements Serializable {
26     private static final long serialVersionUID = 1L;
27
28     @XmlElement
29     private NodeConnector nodeConnector;
30     @XmlElement
31     private long receivePackets;
32     @XmlElement
33     private long transmitPackets;
34     @XmlElement
35     private long receiveBytes;
36     @XmlElement
37     private long transmitBytes;
38     @XmlElement
39     private long receiveDrops;
40     @XmlElement
41     private long transmitDrops;
42     @XmlElement
43     private long receiveErrors;
44     @XmlElement
45     private long transmitErrors;
46     @XmlElement
47     private long receiveFrameError;
48     @XmlElement
49     private long receiveOverRunError;
50     @XmlElement
51     private long receiveCrcError;
52     @XmlElement
53     private long collisionCount;
54
55     @Override
56     public int hashCode() {
57         final int prime = 31;
58         int result = 1;
59         result = prime * result + (int) (collisionCount ^ (collisionCount >>> 32));
60         result = prime * result + ((nodeConnector == null) ? 0 : nodeConnector.hashCode());
61         result = prime * result + (int) (receiveBytes ^ (receiveBytes >>> 32));
62         result = prime * result + (int) (receiveCrcError ^ (receiveCrcError >>> 32));
63         result = prime * result + (int) (receiveDrops ^ (receiveDrops >>> 32));
64         result = prime * result + (int) (receiveErrors ^ (receiveErrors >>> 32));
65         result = prime * result + (int) (receiveFrameError ^ (receiveFrameError >>> 32));
66         result = prime * result + (int) (receiveOverRunError ^ (receiveOverRunError >>> 32));
67         result = prime * result + (int) (receivePackets ^ (receivePackets >>> 32));
68         result = prime * result + (int) (transmitBytes ^ (transmitBytes >>> 32));
69         result = prime * result + (int) (transmitDrops ^ (transmitDrops >>> 32));
70         result = prime * result + (int) (transmitErrors ^ (transmitErrors >>> 32));
71         result = prime * result + (int) (transmitPackets ^ (transmitPackets >>> 32));
72         return result;
73     }
74
75     @Override
76     public boolean equals(Object obj) {
77         if (this == obj) {
78             return true;
79         }
80         if (obj == null) {
81             return false;
82         }
83         if (!(obj instanceof NodeConnectorStatistics)) {
84             return false;
85         }
86         NodeConnectorStatistics other = (NodeConnectorStatistics) obj;
87         if (collisionCount != other.collisionCount) {
88             return false;
89         }
90         if (nodeConnector == null) {
91             if (other.nodeConnector != null) {
92                 return false;
93             }
94         } else if (!nodeConnector.equals(other.nodeConnector)) {
95             return false;
96         }
97         if (receiveBytes != other.receiveBytes) {
98             return false;
99         }
100         if (receiveCrcError != other.receiveCrcError) {
101             return false;
102         }
103         if (receiveDrops != other.receiveDrops) {
104             return false;
105         }
106         if (receiveErrors != other.receiveErrors) {
107             return false;
108         }
109         if (receiveFrameError != other.receiveFrameError) {
110             return false;
111         }
112         if (receiveOverRunError != other.receiveOverRunError) {
113             return false;
114         }
115         if (receivePackets != other.receivePackets) {
116             return false;
117         }
118         if (transmitBytes != other.transmitBytes) {
119             return false;
120         }
121         if (transmitDrops != other.transmitDrops) {
122             return false;
123         }
124         if (transmitErrors != other.transmitErrors) {
125             return false;
126         }
127         if (transmitPackets != other.transmitPackets) {
128             return false;
129         }
130         return true;
131     }
132
133     // To Satisfy JAXB
134     public NodeConnectorStatistics() {
135
136     }
137
138     /**
139      * Set the node connector
140      *
141      * @param port
142      */
143     public void setNodeConnector(NodeConnector port) {
144         this.nodeConnector = port;
145     }
146
147     /**
148      * Returns the node connector
149      *
150      * @return
151      */
152     public NodeConnector getNodeConnector() {
153         return nodeConnector;
154     }
155
156     /**
157      * Set the rx packet count's value
158      *
159      * @param count
160      */
161     public void setReceivePacketCount(long count) {
162         receivePackets = count;
163     }
164
165     /**
166      * Returns the rx packet count for the port
167      *
168      * @return
169      */
170     public long getReceivePacketCount() {
171         return receivePackets;
172     }
173
174     /**
175      * Set the tx packet count's value
176      *
177      * @param count
178      */
179     public void setTransmitPacketCount(long count) {
180         transmitPackets = count;
181     }
182
183     /**
184      * Returns the tx packet count for the port
185      *
186      * @return
187      */
188     public long getTransmitPacketCount() {
189         return transmitPackets;
190     }
191
192     /**
193      * Set the rx byte count's value
194      *
195      * @param count
196      */
197     public void setReceiveByteCount(long count) {
198         receiveBytes = count;
199     }
200
201     /**
202      * Return the rx byte count for the port
203      *
204      * @return
205      */
206     public long getReceiveByteCount() {
207         return receiveBytes;
208     }
209
210     /**
211      * Set the tx byte count's value
212      *
213      * @param count
214      */
215     public void setTransmitByteCount(long count) {
216         transmitBytes = count;
217     }
218
219     /**
220      * Return the tx byte count for the port
221      *
222      * @return
223      */
224     public long getTransmitByteCount() {
225         return transmitBytes;
226     }
227
228     /**
229      * Set the rx drop count's value
230      *
231      * @param count
232      */
233     public void setReceiveDropCount(long count) {
234         receiveDrops = count;
235     }
236
237     /**
238      * Returns the rx drop count for the port
239      *
240      * @return
241      */
242     public long getReceiveDropCount() {
243         return receiveDrops;
244     }
245
246     /**
247      * Set the tx drop count's value
248      *
249      * @param count
250      */
251     public void setTransmitDropCount(long count) {
252         transmitDrops = count;
253     }
254
255     /**
256      * Returns the tx drop count for the port
257      *
258      * @return
259      */
260     public long getTransmitDropCount() {
261         return transmitDrops;
262     }
263
264     /**
265      * Set the rx error count's value
266      *
267      * @param count
268      */
269     public void setReceiveErrorCount(long count) {
270         receiveErrors = count;
271     }
272
273     /**
274      * Return the rx error count for the port
275      *
276      * @return
277      */
278     public long getReceiveErrorCount() {
279         return receiveErrors;
280     }
281
282     /**
283      * Set the tx error count's value
284      *
285      * @param count
286      */
287     public void setTransmitErrorCount(long count) {
288         transmitErrors = count;
289     }
290
291     /**
292      * Return the tx error count for the port
293      *
294      * @return
295      */
296     public long getTransmitErrorCount() {
297         return transmitErrors;
298     }
299
300     /**
301      * Set the rx frame error value
302      *
303      * @param count
304      */
305     public void setReceiveFrameErrorCount(long count) {
306         receiveFrameError = count;
307     }
308
309     /**
310      * Returns the rx frame error for the port
311      *
312      * @return
313      */
314     public long getReceiveFrameErrorCount() {
315         return receiveFrameError;
316     }
317
318     /**
319      * Set the rx overrun error value
320      *
321      * @param count
322      */
323     public void setReceiveOverRunErrorCount(long count) {
324         receiveOverRunError = count;
325     }
326
327     /**
328      * Return the rx overrun error for the port
329      *
330      * @return
331      */
332     public long getReceiveOverRunErrorCount() {
333         return receiveOverRunError;
334     }
335
336     /**
337      * Set the rx CRC Error value
338      *
339      * @param count
340      */
341     public void setReceiveCRCErrorCount(long count) {
342         receiveCrcError = count;
343     }
344
345     /**
346      * Return the rx CRC error for the port
347      *
348      * @return
349      */
350     public long getReceiveCRCErrorCount() {
351         return receiveCrcError;
352     }
353
354     /**
355      * Set the collisionCount count's value
356      *
357      * @param count
358      */
359     public void setCollisionCount(long count) {
360         collisionCount = count;
361     }
362
363     /**
364      * Return the collisionCount count for the port
365      *
366      * @return
367      */
368     public long getCollisionCount() {
369         return collisionCount;
370     }
371
372     @Override
373     public String toString() {
374         return "NodeConnectorStats[portNumber = " + nodeConnector
375             + ", receivePackets = " + receivePackets
376             + ", transmitPackets = " + transmitPackets
377             + ", receiveBytes = " + receiveBytes + ", transmitBytes = "
378             + transmitBytes + ", receiveDrops = " + receiveDrops
379             + ", transmitDrops = " + transmitDrops + ", receiveErrors = "
380             + receiveErrors + ", transmitErrors = " + transmitErrors
381             + ", receiveFrameError = " + receiveFrameError
382             + ", receiveOverRunError = " + receiveOverRunError
383             + ", receiveCrcError = " + receiveCrcError
384             + ", collisionCount = " + collisionCount + "]";
385     }
386
387 }