1 package org.openflow.codec.protocol.queue;
3 import org.openflow.codec.io.IDataBuffer;
4 import org.openflow.codec.util.U16;
7 * Corresponds to the struct ofp_queue_prop_min_rate OpenFlow structure
9 * @author David Erickson (daviderickson@cs.stanford.edu)
11 public class OFPQueuePropertyMinRate extends OFPQueueProperty {
12 public static int MINIMUM_LENGTH = 16;
19 public OFPQueuePropertyMinRate() {
21 this.type = OFPQueuePropertyType.MIN_RATE;
22 this.length = U16.t(MINIMUM_LENGTH);
28 public short getRate() {
36 public OFPQueuePropertyMinRate setRate(short rate) {
42 public void readFrom(IDataBuffer data) {
44 this.rate = data.getShort();
46 data.getShort(); // pad
50 public void writeTo(IDataBuffer data) {
52 data.putShort(this.rate);
53 data.putInt(0); // pad
54 data.putShort((short) 0); // pad
58 public int hashCode() {
59 final int prime = 3259;
60 int result = super.hashCode();
61 result = prime * result + rate;
66 public boolean equals(Object obj) {
69 if (!super.equals(obj))
71 if (!(obj instanceof OFPQueuePropertyMinRate))
73 OFPQueuePropertyMinRate other = (OFPQueuePropertyMinRate) obj;
74 if (rate != other.rate)
82 * @see java.lang.Object#toString()
85 public String toString() {
86 return "OFPQueuePropertyMinRate [type=" + type + ", rate=" + U16.f(rate) + "]";