Merge "Bug 2347: DOMConcurrentDataCommitCoordinator uses wrong phase name"
[controller.git] / third-party / openflowj / src / main / java / org / openflow / protocol / statistics / OFQueueStatisticsRequest.java
1 package org.openflow.protocol.statistics;
2
3 import java.nio.ByteBuffer;
4
5 /**
6  * Represents an ofp_queue_stats_request structure
7  * @author David Erickson (daviderickson@cs.stanford.edu)
8  */
9 public class OFQueueStatisticsRequest implements OFStatistics {
10     protected short portNumber;
11     protected int queueId;
12
13     /**
14      * @return the portNumber
15      */
16     public short getPortNumber() {
17         return portNumber;
18     }
19
20     /**
21      * @param portNumber the portNumber to set
22      */
23     public void setPortNumber(short portNumber) {
24         this.portNumber = portNumber;
25     }
26
27     /**
28      * @return the queueId
29      */
30     public int getQueueId() {
31         return queueId;
32     }
33
34     /**
35      * @param queueId the queueId to set
36      */
37     public void setQueueId(int queueId) {
38         this.queueId = queueId;
39     }
40
41     @Override
42     public int getLength() {
43         return 8;
44     }
45
46     @Override
47     public void readFrom(ByteBuffer data) {
48         this.portNumber = data.getShort();
49         data.getShort(); // pad
50         this.queueId = data.getInt();
51     }
52
53     @Override
54     public void writeTo(ByteBuffer data) {
55         data.putShort(this.portNumber);
56         data.putShort((short) 0); // pad
57         data.putInt(this.queueId);
58     }
59
60     @Override
61     public int hashCode() {
62         final int prime = 443;
63         int result = 1;
64         result = prime * result + portNumber;
65         result = prime * result + queueId;
66         return result;
67     }
68
69     @Override
70     public boolean equals(Object obj) {
71         if (this == obj) {
72             return true;
73         }
74         if (obj == null) {
75             return false;
76         }
77         if (!(obj instanceof OFQueueStatisticsRequest)) {
78             return false;
79         }
80         OFQueueStatisticsRequest other = (OFQueueStatisticsRequest) obj;
81         if (portNumber != other.portNumber) {
82             return false;
83         }
84         if (queueId != other.queueId) {
85             return false;
86         }
87         return true;
88     }
89 }