} // end of marshal method public void unmarshal(DataInputStream dis) { try { _beamDataLength = dis.readByte(); _beamIDNumber = dis.readByte(); _beamParameterIndex = dis.readUshort(); _fundamentalParameterData.unmarshal(dis); _beamFunction = dis.readByte(); _numberOfTrackJamTargets = dis.readByte(); _highDensityTrackJam = dis.readByte(); _pad4 = dis.readByte(); _jammingModeSequence = dis.readUint(); for (int idx = 0; idx < _numberOfTrackJamTargets; idx++) { TrackJamTarget anX = new TrackJamTarget(); anX.unmarshal(dis); _trackJamTargets.Add(anX); } ; } // end try catch (Exception e) { Trace.WriteLine(e); Trace.Flush(); } } // end of unmarshal method
} // end of unmarshal method ///<summary> ///This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. ///This will be modified in the future to provide a better display. Usage: ///pdu.GetType().InvokeMember("reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); ///where pdu is an object representing a single pdu and sb is a StringBuilder. ///Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality ///</summary> public void reflection(StringBuilder sb) { sb.Append("<ElectronicEmissionBeamData>" + System.Environment.NewLine); try { sb.Append("<beamDataLength type=\"byte\">" + _beamDataLength.ToString() + "</beamDataLength> " + System.Environment.NewLine); sb.Append("<beamIDNumber type=\"byte\">" + _beamIDNumber.ToString() + "</beamIDNumber> " + System.Environment.NewLine); sb.Append("<beamParameterIndex type=\"ushort\">" + _beamParameterIndex.ToString() + "</beamParameterIndex> " + System.Environment.NewLine); sb.Append("<fundamentalParameterData>" + System.Environment.NewLine); _fundamentalParameterData.reflection(sb); sb.Append("</fundamentalParameterData>" + System.Environment.NewLine); sb.Append("<beamFunction type=\"byte\">" + _beamFunction.ToString() + "</beamFunction> " + System.Environment.NewLine); sb.Append("<trackJamTargets type=\"byte\">" + _trackJamTargets.Count.ToString() + "</trackJamTargets> " + System.Environment.NewLine); sb.Append("<highDensityTrackJam type=\"byte\">" + _highDensityTrackJam.ToString() + "</highDensityTrackJam> " + System.Environment.NewLine); sb.Append("<pad4 type=\"byte\">" + _pad4.ToString() + "</pad4> " + System.Environment.NewLine); sb.Append("<jammingModeSequence type=\"uint\">" + _jammingModeSequence.ToString() + "</jammingModeSequence> " + System.Environment.NewLine); for (int idx = 0; idx < _trackJamTargets.Count; idx++) { sb.Append("<trackJamTargets" + idx.ToString() + " type=\"TrackJamTarget\">" + System.Environment.NewLine); TrackJamTarget aTrackJamTarget = (TrackJamTarget)_trackJamTargets[idx]; aTrackJamTarget.reflection(sb); sb.Append("</trackJamTargets" + idx.ToString() + ">" + System.Environment.NewLine); } // end of list marshalling sb.Append("</ElectronicEmissionBeamData>" + System.Environment.NewLine); } // end try catch (Exception e) { Trace.WriteLine(e); Trace.Flush(); } } // end of reflection method
///<summary> ///Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method ///</summary> public void marshal(DataOutputStream dos) { try { dos.writeByte((byte)_beamDataLength); dos.writeByte((byte)_beamIDNumber); dos.writeUshort((ushort)_beamParameterIndex); _fundamentalParameterData.marshal(dos); dos.writeByte((byte)_beamFunction); dos.writeByte((byte)_trackJamTargets.Count); dos.writeByte((byte)_highDensityTrackJam); dos.writeByte((byte)_pad4); dos.writeUint((uint)_jammingModeSequence); for (int idx = 0; idx < _trackJamTargets.Count; idx++) { TrackJamTarget aTrackJamTarget = (TrackJamTarget)_trackJamTargets[idx]; aTrackJamTarget.marshal(dos); } // end of list marshalling } // end try catch (Exception e) { Trace.WriteLine(e); Trace.Flush(); } } // end of marshal method
/** * Compares for reference equality and value equality. */ public bool equals(TrackJamTarget rhs) { bool ivarsEqual = true; if (rhs.GetType() != this.GetType()) { return(false); } if (!(_trackJam.Equals(rhs._trackJam))) { ivarsEqual = false; } if (!(_emitterID == rhs._emitterID)) { ivarsEqual = false; } if (!(_beamID == rhs._beamID)) { ivarsEqual = false; } return(ivarsEqual); }
/** * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful. */ public bool equals(ElectronicEmissionBeamData rhs) { bool ivarsEqual = true; if (rhs.GetType() != this.GetType()) { return(false); } if (!(_beamDataLength == rhs._beamDataLength)) { ivarsEqual = false; } if (!(_beamIDNumber == rhs._beamIDNumber)) { ivarsEqual = false; } if (!(_beamParameterIndex == rhs._beamParameterIndex)) { ivarsEqual = false; } if (!(_fundamentalParameterData.Equals(rhs._fundamentalParameterData))) { ivarsEqual = false; } if (!(_beamFunction == rhs._beamFunction)) { ivarsEqual = false; } if (!(_numberOfTrackJamTargets == rhs._numberOfTrackJamTargets)) { ivarsEqual = false; } if (!(_highDensityTrackJam == rhs._highDensityTrackJam)) { ivarsEqual = false; } if (!(_pad4 == rhs._pad4)) { ivarsEqual = false; } if (!(_jammingModeSequence == rhs._jammingModeSequence)) { ivarsEqual = false; } for (int idx = 0; idx < _trackJamTargets.Count; idx++) { TrackJamTarget x = (TrackJamTarget)_trackJamTargets[idx]; if (!(_trackJamTargets[idx].Equals(rhs._trackJamTargets[idx]))) { ivarsEqual = false; } } return(ivarsEqual); }
public int getMarshalledSize() { int marshalSize = 0; marshalSize = marshalSize + 1; // _beamDataLength marshalSize = marshalSize + 1; // _beamIDNumber marshalSize = marshalSize + 2; // _beamParameterIndex marshalSize = marshalSize + _fundamentalParameterData.getMarshalledSize(); // _fundamentalParameterData marshalSize = marshalSize + 1; // _beamFunction marshalSize = marshalSize + 1; // _numberOfTrackJamTargets marshalSize = marshalSize + 1; // _highDensityTrackJam marshalSize = marshalSize + 1; // _pad4 marshalSize = marshalSize + 4; // _jammingModeSequence for (int idx = 0; idx < _trackJamTargets.Count; idx++) { TrackJamTarget listElement = (TrackJamTarget)_trackJamTargets[idx]; marshalSize = marshalSize + listElement.getMarshalledSize(); } return(marshalSize); }
public void unmarshal(DataInputStream dis) { try { _beamDataLength = dis.readByte(); _beamIDNumber = dis.readByte(); _beamParameterIndex = dis.readUshort(); _fundamentalParameterData.unmarshal(dis); _beamFunction = dis.readByte(); _numberOfTrackJamTargets = dis.readByte(); _highDensityTrackJam = dis.readByte(); _pad4 = dis.readByte(); _jammingModeSequence = dis.readUint(); for(int idx = 0; idx < _numberOfTrackJamTargets; idx++) { TrackJamTarget anX = new TrackJamTarget(); anX.unmarshal(dis); _trackJamTargets.Add(anX); }; } // end try catch(Exception e) { Trace.WriteLine(e); Trace.Flush(); } }
/** * Compares for reference equality and value equality. */ public bool equals(TrackJamTarget rhs) { bool ivarsEqual = true; if(rhs.GetType() != this.GetType()) return false; if( ! (_trackJam.Equals( rhs._trackJam) )) ivarsEqual = false; if( ! (_emitterID == rhs._emitterID)) ivarsEqual = false; if( ! (_beamID == rhs._beamID)) ivarsEqual = false; return ivarsEqual; }