Skip to content
Snippets Groups Projects
Commit c276044f authored by Andrew Ferguson's avatar Andrew Ferguson
Browse files

whitespace cleanup

parent 45e54979
No related branches found
No related tags found
No related merge requests found
...@@ -18,12 +18,12 @@ public class OFPacketQueue { ...@@ -18,12 +18,12 @@ public class OFPacketQueue {
protected List<OFQueueProp> properties = new ArrayList<OFQueueProp>(); protected List<OFQueueProp> properties = new ArrayList<OFQueueProp>();
public OFPacketQueue() { public OFPacketQueue() {
this.queueId = -1; this.queueId = -1;
this.length = -1; this.length = -1;
} }
public OFPacketQueue(int queueId) { public OFPacketQueue(int queueId) {
this.queueId = queueId; this.queueId = queueId;
this.length = U16.t(MINIMUM_LENGTH); this.length = U16.t(MINIMUM_LENGTH);
} }
...@@ -40,59 +40,59 @@ public class OFPacketQueue { ...@@ -40,59 +40,59 @@ public class OFPacketQueue {
public void setQueueId(int queueId) { public void setQueueId(int queueId) {
this.queueId = queueId; this.queueId = queueId;
} }
/** /**
* @return the queue's properties * @return the queue's properties
*/ */
public List<OFQueueProp> getProperties() { public List<OFQueueProp> getProperties() {
return properties; return properties;
} }
/** /**
* @param properties the properties to set * @param properties the properties to set
*/ */
public void setProperties(List<OFQueueProp> properties) { public void setProperties(List<OFQueueProp> properties) {
this.properties = properties; this.properties = properties;
this.length = U16.t(MINIMUM_LENGTH); this.length = U16.t(MINIMUM_LENGTH);
for (OFQueueProp prop : properties) { for (OFQueueProp prop : properties) {
this.length += prop.getLength(); this.length += prop.getLength();
} }
} }
/** /**
* @return the length * @return the length
*/ */
public short getLength() { public short getLength() {
return length; return length;
} }
public void readFrom(ChannelBuffer data) { public void readFrom(ChannelBuffer data) {
this.queueId = data.readInt(); this.queueId = data.readInt();
this.length = data.readShort(); this.length = data.readShort();
data.readShort(); // pad data.readShort(); // pad
int availLength = (this.length - MINIMUM_LENGTH); int availLength = (this.length - MINIMUM_LENGTH);
this.properties.clear(); this.properties.clear();
while (availLength > 0) { while (availLength > 0) {
OFQueueProp prop = new OFQueueProp(); OFQueueProp prop = new OFQueueProp();
prop.readFrom(data); prop.readFrom(data);
properties.add(prop); properties.add(prop);
availLength -= prop.getLength(); availLength -= prop.getLength();
} }
} }
public void writeTo(ChannelBuffer data) { public void writeTo(ChannelBuffer data) {
data.writeInt(queueId); data.writeInt(queueId);
data.writeShort(length); data.writeShort(length);
data.writeShort(0); // pad data.writeShort(0); // pad
for (OFQueueProp prop : properties) { for (OFQueueProp prop : properties) {
prop.writeTo(data); prop.writeTo(data);
} }
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 359; final int prime = 359;
...@@ -119,7 +119,7 @@ public class OFPacketQueue { ...@@ -119,7 +119,7 @@ public class OFPacketQueue {
return false; return false;
} }
if (! properties.equals(other.properties)) { if (! properties.equals(other.properties)) {
return false; return false;
} }
return true; return true;
} }
......
...@@ -21,7 +21,7 @@ public class OFQueueGetConfigReply extends OFMessage { ...@@ -21,7 +21,7 @@ public class OFQueueGetConfigReply extends OFMessage {
this.type = OFType.QUEUE_GET_CONFIG_REPLY; this.type = OFType.QUEUE_GET_CONFIG_REPLY;
this.length = U16.t(MINIMUM_LENGTH); this.length = U16.t(MINIMUM_LENGTH);
} }
/** /**
* @return the portNumber * @return the portNumber
*/ */
...@@ -40,31 +40,31 @@ public class OFQueueGetConfigReply extends OFMessage { ...@@ -40,31 +40,31 @@ public class OFQueueGetConfigReply extends OFMessage {
* @return the port's queues * @return the port's queues
*/ */
public List<OFPacketQueue> getQueues() { public List<OFPacketQueue> getQueues() {
return queues; return queues;
} }
/** /**
* @param queues the queues to set * @param queues the queues to set
*/ */
public void setQueues(List<OFPacketQueue> queues) { public void setQueues(List<OFPacketQueue> queues) {
this.queues = queues; this.queues = queues;
} }
@Override @Override
public void readFrom(ChannelBuffer data) { public void readFrom(ChannelBuffer data) {
super.readFrom(data); super.readFrom(data);
this.portNumber = data.readShort(); this.portNumber = data.readShort();
data.readInt(); // pad data.readInt(); // pad
data.readShort(); // pad data.readShort(); // pad
int availLength = (this.length - MINIMUM_LENGTH); int availLength = (this.length - MINIMUM_LENGTH);
this.queues.clear(); this.queues.clear();
while (availLength > 0) { while (availLength > 0) {
OFPacketQueue queue = new OFPacketQueue(); OFPacketQueue queue = new OFPacketQueue();
queue.readFrom(data); queue.readFrom(data);
queues.add(queue); queues.add(queue);
availLength -= queue.getLength(); availLength -= queue.getLength();
} }
} }
...@@ -74,12 +74,12 @@ public class OFQueueGetConfigReply extends OFMessage { ...@@ -74,12 +74,12 @@ public class OFQueueGetConfigReply extends OFMessage {
data.writeShort(this.portNumber); data.writeShort(this.portNumber);
data.writeInt(0); // pad data.writeInt(0); // pad
data.writeShort(0); // pad data.writeShort(0); // pad
for (OFPacketQueue queue : queues) { for (OFPacketQueue queue : queues) {
queue.writeTo(data); queue.writeTo(data);
} }
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 349; final int prime = 349;
......
...@@ -17,7 +17,7 @@ public class OFQueueGetConfigRequest extends OFMessage { ...@@ -17,7 +17,7 @@ public class OFQueueGetConfigRequest extends OFMessage {
this.type = OFType.QUEUE_GET_CONFIG_REQUEST; this.type = OFType.QUEUE_GET_CONFIG_REQUEST;
this.length = U16.t(MINIMUM_LENGTH); this.length = U16.t(MINIMUM_LENGTH);
} }
/** /**
* @return the portNumber * @return the portNumber
*/ */
...@@ -45,7 +45,7 @@ public class OFQueueGetConfigRequest extends OFMessage { ...@@ -45,7 +45,7 @@ public class OFQueueGetConfigRequest extends OFMessage {
data.writeShort(this.portNumber); data.writeShort(this.portNumber);
data.writeShort(0); // pad data.writeShort(0); // pad
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 347; final int prime = 347;
......
...@@ -4,13 +4,13 @@ import org.jboss.netty.buffer.ChannelBuffer; ...@@ -4,13 +4,13 @@ import org.jboss.netty.buffer.ChannelBuffer;
import org.openflow.util.U16; import org.openflow.util.U16;
public class OFQueueProp { public class OFQueueProp {
private int NONE_MINIMUM_LENGTH = 8; private int NONE_MINIMUM_LENGTH = 8;
private int MIN_RATE_MINIMUM_LENGTH = 16; private int MIN_RATE_MINIMUM_LENGTH = 16;
public enum OFQueuePropType { public enum OFQueuePropType {
OFPQT_NONE (0), OFPQT_NONE (0),
OFPQT_MIN_RATE (1); OFPQT_MIN_RATE (1);
protected int value; protected int value;
private OFQueuePropType(int value) { private OFQueuePropType(int value) {
...@@ -23,15 +23,15 @@ public class OFQueueProp { ...@@ -23,15 +23,15 @@ public class OFQueueProp {
public int getValue() { public int getValue() {
return value; return value;
} }
public static OFQueuePropType fromShort(short x) { public static OFQueuePropType fromShort(short x) {
switch (x) { switch (x) {
case 0: case 0:
return OFPQT_NONE; return OFPQT_NONE;
case 1: case 1:
return OFPQT_MIN_RATE; return OFPQT_MIN_RATE;
} }
return null; return null;
} }
} }
...@@ -43,79 +43,79 @@ public class OFQueueProp { ...@@ -43,79 +43,79 @@ public class OFQueueProp {
this.type = OFQueuePropType.OFPQT_NONE; this.type = OFQueuePropType.OFPQT_NONE;
this.length = U16.t(NONE_MINIMUM_LENGTH); this.length = U16.t(NONE_MINIMUM_LENGTH);
} }
/** /**
* @return the type * @return the type
*/ */
public OFQueuePropType getType() { public OFQueuePropType getType() {
return type; return type;
} }
/** /**
* @param type the type to set * @param type the type to set
*/ */
public void setType(OFQueuePropType type) { public void setType(OFQueuePropType type) {
this.type = type; this.type = type;
switch (type) { switch (type) {
case OFPQT_NONE: case OFPQT_NONE:
this.length = U16.t(NONE_MINIMUM_LENGTH); this.length = U16.t(NONE_MINIMUM_LENGTH);
break; break;
case OFPQT_MIN_RATE: case OFPQT_MIN_RATE:
this.length = U16.t(MIN_RATE_MINIMUM_LENGTH); this.length = U16.t(MIN_RATE_MINIMUM_LENGTH);
break; break;
} }
} }
/** /**
* @return the rate * @return the rate
*/ */
public short getRate() { public short getRate() {
return rate; return rate;
} }
/** /**
* @param rate the rate to set * @param rate the rate to set
*/ */
public void setRate(short rate) { public void setRate(short rate) {
this.rate = rate; this.rate = rate;
} }
/** /**
* @return the length * @return the length
*/ */
public short getLength() { public short getLength() {
return length; return length;
} }
public void readFrom(ChannelBuffer data) { public void readFrom(ChannelBuffer data) {
this.type = OFQueuePropType.fromShort(data.readShort()); this.type = OFQueuePropType.fromShort(data.readShort());
this.length = data.readShort(); this.length = data.readShort();
data.readInt(); // pad data.readInt(); // pad
if (this.type == OFQueuePropType.OFPQT_MIN_RATE) { if (this.type == OFQueuePropType.OFPQT_MIN_RATE) {
assert(this.length == MIN_RATE_MINIMUM_LENGTH); assert(this.length == MIN_RATE_MINIMUM_LENGTH);
this.rate = data.readShort(); this.rate = data.readShort();
data.readInt(); // pad data.readInt(); // pad
data.readShort(); // pad data.readShort(); // pad
} else { } else {
assert(this.length == NONE_MINIMUM_LENGTH); assert(this.length == NONE_MINIMUM_LENGTH);
} }
} }
public void writeTo(ChannelBuffer data) { public void writeTo(ChannelBuffer data) {
data.writeShort(this.type.getValue()); data.writeShort(this.type.getValue());
data.writeShort(this.length); data.writeShort(this.length);
data.writeInt(0); // pad data.writeInt(0); // pad
if (this.type == OFQueuePropType.OFPQT_MIN_RATE) { if (this.type == OFQueuePropType.OFPQT_MIN_RATE) {
data.writeShort(this.rate); data.writeShort(this.rate);
data.writeInt(0); // pad data.writeInt(0); // pad
data.writeShort(0); // pad data.writeShort(0); // pad
} }
} }
@Override @Override
public int hashCode() { public int hashCode() {
final int prime = 353; final int prime = 353;
...@@ -141,9 +141,9 @@ public class OFQueueProp { ...@@ -141,9 +141,9 @@ public class OFQueueProp {
return false; return false;
} }
if (type == OFQueuePropType.OFPQT_MIN_RATE) { if (type == OFQueuePropType.OFPQT_MIN_RATE) {
if (rate != other.rate) { if (rate != other.rate) {
return false; return false;
} }
} }
return true; return true;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment