1 package org.openflow.protocol.queue;
3 import java.nio.ByteBuffer;
5 import org.openflow.util.U16;
8 * Corresponds to the struct struct ofp_queue_prop_min_rate OpenFlow structure
10 * @author David Erickson (daviderickson@cs.stanford.edu)
12 public class OFQueuePropertyMinRate extends OFQueueProperty {
13 public static int MINIMUM_LENGTH = 16;
20 public OFQueuePropertyMinRate() {
22 this.type = OFQueuePropertyType.MIN_RATE;
23 this.length = U16.t(MINIMUM_LENGTH);
29 public short getRate() {
34 * @param rate the rate to set
36 public OFQueuePropertyMinRate setRate(short rate) {
42 public void readFrom(ByteBuffer data) {
44 this.rate = data.getShort();
46 data.getShort(); // pad
50 public void writeTo(ByteBuffer 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 OFQueuePropertyMinRate))
73 OFQueuePropertyMinRate other = (OFQueuePropertyMinRate) obj;
74 if (rate != other.rate)
80 * @see java.lang.Object#toString()
83 public String toString() {
84 return "OFQueuePropertyMinRate [type=" + type + ", rate=" + U16.f(rate) + "]";