Fix checkstyle warnings in netconf-cli
[controller.git] / third-party / openflowj / src / main / java / org / openflow / protocol / statistics / OFQueueStatisticsReply.java
1 package org.openflow.protocol.statistics;
2
3 import java.nio.ByteBuffer;
4
5 /**
6  * Represents an ofp_queue_stats structure
7  * @author David Erickson (daviderickson@cs.stanford.edu)
8  */
9 public class OFQueueStatisticsReply implements OFStatistics {
10     protected short portNumber;
11     protected int queueId;
12     protected long transmitBytes;
13     protected long transmitPackets;
14     protected long transmitErrors;
15
16     /**
17      * @return the portNumber
18      */
19     public short getPortNumber() {
20         return portNumber;
21     }
22
23     /**
24      * @param portNumber the portNumber to set
25      */
26     public void setPortNumber(short portNumber) {
27         this.portNumber = portNumber;
28     }
29
30     /**
31      * @return the queueId
32      */
33     public int getQueueId() {
34         return queueId;
35     }
36
37     /**
38      * @param queueId the queueId to set
39      */
40     public void setQueueId(int queueId) {
41         this.queueId = queueId;
42     }
43
44     /**
45      * @return the transmitBytes
46      */
47     public long getTransmitBytes() {
48         return transmitBytes;
49     }
50
51     /**
52      * @param transmitBytes the transmitBytes to set
53      */
54     public void setTransmitBytes(long transmitBytes) {
55         this.transmitBytes = transmitBytes;
56     }
57
58     /**
59      * @return the transmitPackets
60      */
61     public long getTransmitPackets() {
62         return transmitPackets;
63     }
64
65     /**
66      * @param transmitPackets the transmitPackets to set
67      */
68     public void setTransmitPackets(long transmitPackets) {
69         this.transmitPackets = transmitPackets;
70     }
71
72     /**
73      * @return the transmitErrors
74      */
75     public long getTransmitErrors() {
76         return transmitErrors;
77     }
78
79     /**
80      * @param transmitErrors the transmitErrors to set
81      */
82     public void setTransmitErrors(long transmitErrors) {
83         this.transmitErrors = transmitErrors;
84     }
85
86     @Override
87     public int getLength() {
88         return 32;
89     }
90
91     @Override
92     public void readFrom(ByteBuffer data) {
93         this.portNumber = data.getShort();
94         data.getShort(); // pad
95         this.queueId = data.getInt();
96         this.transmitBytes = data.getLong();
97         this.transmitPackets = data.getLong();
98         this.transmitErrors = data.getLong();
99     }
100
101     @Override
102     public void writeTo(ByteBuffer data) {
103         data.putShort(this.portNumber);
104         data.putShort((short) 0); // pad
105         data.putInt(this.queueId);
106         data.putLong(this.transmitBytes);
107         data.putLong(this.transmitPackets);
108         data.putLong(this.transmitErrors);
109     }
110
111     @Override
112     public int hashCode() {
113         final int prime = 439;
114         int result = 1;
115         result = prime * result + portNumber;
116         result = prime * result + queueId;
117         result = prime * result
118                 + (int) (transmitBytes ^ (transmitBytes >>> 32));
119         result = prime * result
120                 + (int) (transmitErrors ^ (transmitErrors >>> 32));
121         result = prime * result
122                 + (int) (transmitPackets ^ (transmitPackets >>> 32));
123         return result;
124     }
125
126     @Override
127     public boolean equals(Object obj) {
128         if (this == obj) {
129             return true;
130         }
131         if (obj == null) {
132             return false;
133         }
134         if (!(obj instanceof OFQueueStatisticsReply)) {
135             return false;
136         }
137         OFQueueStatisticsReply other = (OFQueueStatisticsReply) obj;
138         if (portNumber != other.portNumber) {
139             return false;
140         }
141         if (queueId != other.queueId) {
142             return false;
143         }
144         if (transmitBytes != other.transmitBytes) {
145             return false;
146         }
147         if (transmitErrors != other.transmitErrors) {
148             return false;
149         }
150         if (transmitPackets != other.transmitPackets) {
151             return false;
152         }
153         return true;
154     }
155 }