public object Clone()
 {
     FloodingQueryApplicationMessage clone = new FloodingQueryApplicationMessage();
     return clone;
 }
        void processApplicationMessage(FloodingQueryApplicationMessage message)
        {
            // When an application message is received, create and send a data message toward the Sink. If no Sink path
            // exists, broadcast the data message.
            FloodingQueryMessage dataMessage;
            MessageEvent outputEvent;
            if (message.IsEventOccurrance)
            {
                if (this.nextHop != int.MaxValue)
                    dataMessage = new FloodingQueryMessage(this.id, this.nextHop, FloodingQueryMessage.MessageType.data,
                        CurrentMessageID, this.id);
                else
                    dataMessage = new FloodingQueryMessage(this.id, 0xffff, FloodingQueryMessage.MessageType.data,
                        CurrentMessageID, this.id);

                dataMessage.SourceLoc = this.Location;

                outputEvent = new MessageEvent(dataMessage);
                outputEvent.Referrer = this;
                this.PhysProc.ExecuteAction(outputEvent);
            }
        }
        public void GenerateEvent(double time, ILocation location)
        {
            // Overloads GenerateEvent to allow the simulation to provide the time the event occurs.
            XYDoubleLocation initalCorner = (XYDoubleLocation)field[0];  // Casting to xyLocation objects. Other
            XYDoubleLocation finalCorner = (XYDoubleLocation)field[1];     // coordinate systems are not supported.

            // Generate the random center location of the event.
            eventCenter = (XYDoubleLocation)location;

            eventCenter.SetField(field);

            Notify(generateStaticReport(time, eventCenter));

            foreach (FloodingQueryNode node in nodes.NodeQueue)
            { // Find which nodes are within the effective detection area.
                if (eventCenter.Distance(node.Location) <= eventSize) // if in the event area
                {
                    FloodingQueryApplicationMessage appMsg = new FloodingQueryApplicationMessage(); // Create a new app message
                    MessageEvent msgEvent = new MessageEvent(appMsg); // create a new message event
                    msgEvent.Referrer = node; // set the referrer to the current node

                    NodeTimerEvent timerEvent = new NodeTimerEvent();   // create a timer event
                    timerEvent.Time = time;
                    timerEvent.Event = msgEvent;                        // apply the message event
                    timerEvent.node = node;
                    eventMgr.AddEvent(timerEvent);                      // add the event to the Event Queue.
                }
            }
        }