Ejemplo n.º 1
0
        } // 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>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<ResupplyOfferPdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<receivingEntityID>" + System.Environment.NewLine);
                _receivingEntityID.reflection(sb);
                sb.Append("</receivingEntityID>" + System.Environment.NewLine);
                sb.Append("<supplyingEntityID>" + System.Environment.NewLine);
                _supplyingEntityID.reflection(sb);
                sb.Append("</supplyingEntityID>" + System.Environment.NewLine);
                sb.Append("<supplies type=\"byte\">" + _supplies.Count.ToString() + "</supplies> " + System.Environment.NewLine);
                sb.Append("<padding1 type=\"short\">" + _padding1.ToString() + "</padding1> " + System.Environment.NewLine);
                sb.Append("<padding2 type=\"byte\">" + _padding2.ToString() + "</padding2> " + System.Environment.NewLine);

                for (int idx = 0; idx < _supplies.Count; idx++)
                {
                    sb.Append("<supplies" + idx.ToString() + " type=\"SupplyQuantity\">" + System.Environment.NewLine);
                    SupplyQuantity aSupplyQuantity = (SupplyQuantity)_supplies[idx];
                    aSupplyQuantity.reflection(sb);
                    sb.Append("</supplies" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</ResupplyOfferPdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
Ejemplo n.º 2
0
        } // 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>
        new public void reflection(StringBuilder sb)
        {
            sb.Append("<ServiceRequestPdu>" + System.Environment.NewLine);
            base.reflection(sb);
            try
            {
                sb.Append("<requestingEntityID>" + System.Environment.NewLine);
                _requestingEntityID.reflection(sb);
                sb.Append("</requestingEntityID>" + System.Environment.NewLine);
                sb.Append("<servicingEntityID>" + System.Environment.NewLine);
                _servicingEntityID.reflection(sb);
                sb.Append("</servicingEntityID>" + System.Environment.NewLine);
                sb.Append("<serviceTypeRequested type=\"byte\">" + _serviceTypeRequested.ToString() + "</serviceTypeRequested> " + System.Environment.NewLine);
                sb.Append("<supplies type=\"byte\">" + _supplies.Count.ToString() + "</supplies> " + System.Environment.NewLine);
                sb.Append("<serviceRequestPadding type=\"short\">" + _serviceRequestPadding.ToString() + "</serviceRequestPadding> " + System.Environment.NewLine);

                for (int idx = 0; idx < _supplies.Count; idx++)
                {
                    sb.Append("<supplies" + idx.ToString() + " type=\"SupplyQuantity\">" + System.Environment.NewLine);
                    SupplyQuantity aSupplyQuantity = (SupplyQuantity)_supplies[idx];
                    aSupplyQuantity.reflection(sb);
                    sb.Append("</supplies" + idx.ToString() + ">" + System.Environment.NewLine);
                } // end of list marshalling

                sb.Append("</ServiceRequestPdu>" + System.Environment.NewLine);
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
Ejemplo n.º 3
0
        } // end of marshal method

        new public void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _receivingEntityID.unmarshal(dis);
                _supplyingEntityID.unmarshal(dis);
                _numberOfSupplyTypes = dis.readByte();
                _padding1            = dis.readShort();
                _padding2            = dis.readByte();
                for (int idx = 0; idx < _numberOfSupplyTypes; idx++)
                {
                    SupplyQuantity anX = new SupplyQuantity();
                    anX.unmarshal(dis);
                    _supplies.Add(anX);
                }
                ;
            } // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of unmarshal method
Ejemplo n.º 4
0
        new public int getMarshalledSize()
        {
            int marshalSize = 0;

            marshalSize = base.getMarshalledSize();
            marshalSize = marshalSize + _receivingEntityID.getMarshalledSize(); // _receivingEntityID
            marshalSize = marshalSize + _supplyingEntityID.getMarshalledSize(); // _supplyingEntityID
            marshalSize = marshalSize + 1;                                      // _numberOfSupplyTypes
            marshalSize = marshalSize + 2;                                      // _padding1
            marshalSize = marshalSize + 1;                                      // _padding2
            for (int idx = 0; idx < _supplies.Count; idx++)
            {
                SupplyQuantity listElement = (SupplyQuantity)_supplies[idx];
                marshalSize = marshalSize + listElement.getMarshalledSize();
            }

            return(marshalSize);
        }
Ejemplo n.º 5
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(ResupplyOfferPdu rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_receivingEntityID.Equals(rhs._receivingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_supplyingEntityID.Equals(rhs._supplyingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSupplyTypes == rhs._numberOfSupplyTypes))
            {
                ivarsEqual = false;
            }
            if (!(_padding1 == rhs._padding1))
            {
                ivarsEqual = false;
            }
            if (!(_padding2 == rhs._padding2))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _supplies.Count; idx++)
            {
                SupplyQuantity x = (SupplyQuantity)_supplies[idx];
                if (!(_supplies[idx].Equals(rhs._supplies[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
Ejemplo n.º 6
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(ServiceRequestPdu rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_requestingEntityID.Equals(rhs._requestingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_servicingEntityID.Equals(rhs._servicingEntityID)))
            {
                ivarsEqual = false;
            }
            if (!(_serviceTypeRequested == rhs._serviceTypeRequested))
            {
                ivarsEqual = false;
            }
            if (!(_numberOfSupplyTypes == rhs._numberOfSupplyTypes))
            {
                ivarsEqual = false;
            }
            if (!(_serviceRequestPadding == rhs._serviceRequestPadding))
            {
                ivarsEqual = false;
            }

            for (int idx = 0; idx < _supplies.Count; idx++)
            {
                SupplyQuantity x = (SupplyQuantity)_supplies[idx];
                if (!(_supplies[idx].Equals(rhs._supplies[idx])))
                {
                    ivarsEqual = false;
                }
            }


            return(ivarsEqual);
        }
Ejemplo n.º 7
0
        /**
         * The equals method doesn't always work--mostly on on classes that consist only of primitives. Be careful.
         */
        public bool equals(SupplyQuantity rhs)
        {
            bool ivarsEqual = true;

            if (rhs.GetType() != this.GetType())
            {
                return(false);
            }

            if (!(_supplyType.Equals(rhs._supplyType)))
            {
                ivarsEqual = false;
            }
            if (!(_quantity == rhs._quantity))
            {
                ivarsEqual = false;
            }

            return(ivarsEqual);
        }
Ejemplo n.º 8
0
///<summary>
///Marshal the data to the DataOutputStream.  Note: Length needs to be set before calling this method
///</summary>
        new public void marshal(DataOutputStream dos)
        {
            base.marshal(dos);
            try
            {
                _receivingEntityID.marshal(dos);
                _supplyingEntityID.marshal(dos);
                dos.writeByte((byte)_supplies.Count);
                dos.writeShort((short)_padding1);
                dos.writeByte((byte)_padding2);

                for (int idx = 0; idx < _supplies.Count; idx++)
                {
                    SupplyQuantity aSupplyQuantity = (SupplyQuantity)_supplies[idx];
                    aSupplyQuantity.marshal(dos);
                } // end of list marshalling
            }     // end try
            catch (Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        } // end of marshal method
        public new void unmarshal(DataInputStream dis)
        {
            base.unmarshal(dis);

            try
            {
                _requestingEntityID.unmarshal(dis);
                _servicingEntityID.unmarshal(dis);
                _serviceTypeRequested = dis.readByte();
                _numberOfSupplyTypes = dis.readByte();
                _serviceRequestPadding = dis.readShort();
                for(int idx = 0; idx < _numberOfSupplyTypes; idx++)
                {
                    SupplyQuantity anX = new SupplyQuantity();
                    anX.unmarshal(dis);
                    _supplies.Add(anX);
                };

            } // end try
            catch(Exception e)
            {
                Trace.WriteLine(e);
                Trace.Flush();
            }
        }
Ejemplo n.º 10
0
        /**
         * Compares for reference equality and value equality.
         */
        public bool equals(SupplyQuantity rhs)
        {
            bool ivarsEqual = true;

            if(rhs.GetType() != this.GetType())
                return false;

            if( ! (_supplyType.Equals( rhs._supplyType) )) ivarsEqual = false;
            if( ! (_quantity == rhs._quantity)) ivarsEqual = false;

            return ivarsEqual;
        }