/** * Unpacks a Pdu from the underlying data. * * @throws java.nio.BufferUnderflowException if buff is too small * @see java.nio.ByteBuffer * @param buff The ByteBuffer at the position to begin reading * @since ?? */ public void unmarshal(java.nio.ByteBuffer buff) { super.unmarshal(buff); minefieldID.unmarshal(buff); requestingEntityID.unmarshal(buff); minefieldSequenceNumbeer = (int) (buff.getShort() & 0xFFFF); requestID = (short) (buff.get() & 0xFF); pduSequenceNumber = (short) (buff.get() & 0xFF); numberOfPdus = (short) (buff.get() & 0xFF); numberOfMinesInThisPdu = (short) (buff.get() & 0xFF); numberOfSensorTypes = (short) (buff.get() & 0xFF); pad2 = (short) (buff.get() & 0xFF); dataFilter = buff.getInt(); mineType.unmarshal(buff); for (int idx = 0; idx < numberOfSensorTypes; idx++) { TwoByteChunk anX = new TwoByteChunk(); anX.unmarshal(buff); sensorTypes.add(anX); } pad3 = (short) (buff.get() & 0xFF); for (int idx = 0; idx < numberOfMinesInThisPdu; idx++) { Vector3Float anX = new Vector3Float(); anX.unmarshal(buff); mineLocation.add(anX); } } // end of unmarshal method
public int getMarshalledSize() { int marshalSize = 0; marshalSize = super.getMarshalledSize(); marshalSize = marshalSize + minefieldID.getMarshalledSize(); // minefieldID marshalSize = marshalSize + requestingEntityID.getMarshalledSize(); // requestingEntityID marshalSize = marshalSize + 2; // minefieldSequenceNumbeer marshalSize = marshalSize + 1; // requestID marshalSize = marshalSize + 1; // pduSequenceNumber marshalSize = marshalSize + 1; // numberOfPdus marshalSize = marshalSize + 1; // numberOfMinesInThisPdu marshalSize = marshalSize + 1; // numberOfSensorTypes marshalSize = marshalSize + 1; // pad2 marshalSize = marshalSize + 4; // dataFilter marshalSize = marshalSize + mineType.getMarshalledSize(); // mineType for (int idx = 0; idx < sensorTypes.size(); idx++) { TwoByteChunk listElement = sensorTypes.get(idx); marshalSize = marshalSize + listElement.getMarshalledSize(); } marshalSize = marshalSize + 1; // pad3 for (int idx = 0; idx < mineLocation.size(); idx++) { Vector3Float listElement = mineLocation.get(idx); marshalSize = marshalSize + listElement.getMarshalledSize(); } return marshalSize; }
public void unmarshal(DataInputStream dis) { super.unmarshal(dis); try { minefieldID.unmarshal(dis); requestingEntityID.unmarshal(dis); minefieldSequenceNumbeer = (int) dis.readUnsignedShort(); requestID = (short) dis.readUnsignedByte(); pduSequenceNumber = (short) dis.readUnsignedByte(); numberOfPdus = (short) dis.readUnsignedByte(); numberOfMinesInThisPdu = (short) dis.readUnsignedByte(); numberOfSensorTypes = (short) dis.readUnsignedByte(); pad2 = (short) dis.readUnsignedByte(); dataFilter = dis.readInt(); mineType.unmarshal(dis); for (int idx = 0; idx < numberOfSensorTypes; idx++) { TwoByteChunk anX = new TwoByteChunk(); anX.unmarshal(dis); sensorTypes.add(anX); } pad3 = (short) dis.readUnsignedByte(); for (int idx = 0; idx < numberOfMinesInThisPdu; idx++) { Vector3Float anX = new Vector3Float(); anX.unmarshal(dis); mineLocation.add(anX); } } // end try catch (Exception e) { System.out.println(e); } } // end of unmarshal method
/** * Packs a Pdu into the ByteBuffer. * * @throws java.nio.BufferOverflowException if buff is too small * @throws java.nio.ReadOnlyBufferException if buff is read only * @see java.nio.ByteBuffer * @param buff The ByteBuffer at the position to begin writing * @since ?? */ public void marshal(java.nio.ByteBuffer buff) { super.marshal(buff); minefieldID.marshal(buff); requestingEntityID.marshal(buff); buff.putShort((short) minefieldSequenceNumbeer); buff.put((byte) requestID); buff.put((byte) pduSequenceNumber); buff.put((byte) numberOfPdus); buff.put((byte) mineLocation.size()); buff.put((byte) sensorTypes.size()); buff.put((byte) pad2); buff.putInt((int) dataFilter); mineType.marshal(buff); for (int idx = 0; idx < sensorTypes.size(); idx++) { TwoByteChunk aTwoByteChunk = (TwoByteChunk) sensorTypes.get(idx); aTwoByteChunk.marshal(buff); } // end of list marshalling buff.put((byte) pad3); for (int idx = 0; idx < mineLocation.size(); idx++) { Vector3Float aVector3Float = (Vector3Float) mineLocation.get(idx); aVector3Float.marshal(buff); } // end of list marshalling } // end of marshal method
public void marshal(DataOutputStream dos) { super.marshal(dos); try { minefieldID.marshal(dos); requestingEntityID.marshal(dos); dos.writeShort((short) minefieldSequenceNumbeer); dos.writeByte((byte) requestID); dos.writeByte((byte) pduSequenceNumber); dos.writeByte((byte) numberOfPdus); dos.writeByte((byte) mineLocation.size()); dos.writeByte((byte) sensorTypes.size()); dos.writeByte((byte) pad2); dos.writeInt((int) dataFilter); mineType.marshal(dos); for (int idx = 0; idx < sensorTypes.size(); idx++) { TwoByteChunk aTwoByteChunk = sensorTypes.get(idx); aTwoByteChunk.marshal(dos); } // end of list marshalling dos.writeByte((byte) pad3); for (int idx = 0; idx < mineLocation.size(); idx++) { Vector3Float aVector3Float = mineLocation.get(idx); aVector3Float.marshal(dos); } // end of list marshalling } // end try catch (Exception e) { System.out.println(e); } } // end of marshal method
/** * Packs a Pdu into the ByteBuffer. * * @throws java.nio.BufferOverflowException if buff is too small * @throws java.nio.ReadOnlyBufferException if buff is read only * @see java.nio.ByteBuffer * @param buff The ByteBuffer at the position to begin writing * @since ?? */ public void marshal(java.nio.ByteBuffer buff) { super.marshal(buff); orginatingEntityID.marshal(buff); receivingEntityID.marshal(buff); relationship.marshal(buff); partLocation.marshal(buff); namedLocationID.marshal(buff); partEntityType.marshal(buff); } // end of marshal method
public int getMarshalledSize() { int marshalSize = 0; marshalSize = super.getMarshalledSize(); marshalSize = marshalSize + orginatingEntityID.getMarshalledSize(); // orginatingEntityID marshalSize = marshalSize + receivingEntityID.getMarshalledSize(); // receivingEntityID marshalSize = marshalSize + relationship.getMarshalledSize(); // relationship marshalSize = marshalSize + partLocation.getMarshalledSize(); // partLocation marshalSize = marshalSize + namedLocationID.getMarshalledSize(); // namedLocationID marshalSize = marshalSize + partEntityType.getMarshalledSize(); // partEntityType return marshalSize; }
public void marshal(DataOutputStream dos) { super.marshal(dos); try { orginatingEntityID.marshal(dos); receivingEntityID.marshal(dos); relationship.marshal(dos); partLocation.marshal(dos); namedLocationID.marshal(dos); partEntityType.marshal(dos); } // end try catch (Exception e) { System.out.println(e); } } // end of marshal method
@Override public boolean equalsImpl(Object obj) { boolean ivarsEqual = true; if (!(obj instanceof IsPartOfPdu)) return false; final IsPartOfPdu rhs = (IsPartOfPdu) obj; if (!(orginatingEntityID.equals(rhs.orginatingEntityID))) ivarsEqual = false; if (!(receivingEntityID.equals(rhs.receivingEntityID))) ivarsEqual = false; if (!(relationship.equals(rhs.relationship))) ivarsEqual = false; if (!(partLocation.equals(rhs.partLocation))) ivarsEqual = false; if (!(namedLocationID.equals(rhs.namedLocationID))) ivarsEqual = false; if (!(partEntityType.equals(rhs.partEntityType))) ivarsEqual = false; return ivarsEqual && super.equalsImpl(rhs); }