X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2Fstatistics%2Ftable%2FOFPTableFeaturePropExperimenter.java;fp=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2Fstatistics%2Ftable%2FOFPTableFeaturePropExperimenter.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=ab2cd7388aa2e921ead1689e754a394aa83562e3;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/statistics/table/OFPTableFeaturePropExperimenter.java b/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/statistics/table/OFPTableFeaturePropExperimenter.java deleted file mode 100644 index ab2cd738..00000000 --- a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/statistics/table/OFPTableFeaturePropExperimenter.java +++ /dev/null @@ -1,140 +0,0 @@ -package org.openflow.codec.protocol.statistics.table; - -import java.util.Arrays; - -import org.openflow.codec.io.IDataBuffer; - -/** - * Represents struct ofp_table_feature_prop_experimenter - * - * @author AnilGujele - * - */ -public class OFPTableFeaturePropExperimenter extends OFPTableFeaturePropHeader { - private static final short MINIMUM_LENGTH = 12; - private int expId; - private int expType; - private int[] expData = new int[0]; - - /** - * constructor - */ - public OFPTableFeaturePropExperimenter() { - super.setOFTableFeaturePropType(OFPTableFeaturePropType.EXPERIMENTER); - super.setLength(OFPTableFeaturePropExperimenter.MINIMUM_LENGTH); - } - - public int getExpId() { - return expId; - } - - public void setExpId(int expId) { - this.expId = expId; - } - - public int getExpType() { - return expType; - } - - public void setExpType(int expType) { - this.expType = expType; - } - - public int[] getExpData() { - return expData; - } - - public void setExpData(int[] expData) { - this.expData = expData; - updateLength(); - } - - /** - * update the length - * - */ - private void updateLength() { - int length = this.getLength() + (expData.length * 4); - this.setLength((short) length); - - } - - /** - * read OFPTableFeaturePropExperimenter from buffer - * - * @param data - */ - public void readFrom(IDataBuffer data) { - super.readFrom(data); - this.expId = data.getInt(); - this.expType = data.getInt(); - int dataLength = this.getLengthU() - OFPTableFeaturePropExperimenter.MINIMUM_LENGTH; - int intDataLength = dataLength / 4; - expData = new int[intDataLength]; - for (int i = 0; i < intDataLength; i++) { - expData[i] = data.getInt(); - } - - /* Read the padding, if any */ - int paddingLength = ((this.getLengthU() % MULTIPLE_OF_EIGHT) == 0) ? 0 : (MULTIPLE_OF_EIGHT - (this - .getLengthU() % MULTIPLE_OF_EIGHT)); - data.position(data.position() + paddingLength); - - } - - /** - * write OFPTableFeaturePropExperimenter to buffer - * - * @param data - */ - public void writeTo(IDataBuffer data) { - super.writeTo(data); - data.putInt(this.expId); - data.putInt(this.expType); - for (int value : expData) { - data.putInt(value); - } - - /* Add padding if structure is not 8 byte aligned */ - int paddingLength = ((this.getLengthU() % MULTIPLE_OF_EIGHT) == 0) ? 0 : (MULTIPLE_OF_EIGHT - (this - .getLengthU() % MULTIPLE_OF_EIGHT)); - byte[] padding = new byte[paddingLength]; - data.put(padding); - - } - - @Override - public int hashCode() { - final int prime = 746; - int result = super.hashCode(); - result = prime * result + expId; - result = prime * result + expType; - result = prime * result + Arrays.hashCode(expData); - return result; - } - - @Override - public boolean equals(Object obj) { - if (this == obj) { - return true; - } - if (!super.equals(obj)) { - return false; - } - if (!(obj instanceof OFPTableFeaturePropExperimenter)) { - return false; - } - OFPTableFeaturePropExperimenter other = (OFPTableFeaturePropExperimenter) obj; - if (this.expId != other.expId) { - return false; - } - if (this.expType != other.expType) { - return false; - } - if (!Arrays.equals(expData, other.expData)) { - return false; - } - return true; - } - -}