/* -------------------------------------------------------- * * Aaron Morris * * CS567 * * Object-Oriented Event-Driven Simulation * * * * Extended SimEvent class representing arrival events in * * the simulation. * * * * -------------------------------------------------------- */ //package datasend; import java.awt.*; public class RequestEvent extends SimEvent { protected boolean spawn; // generate next event once // Basic Object Constructor. Initializes all Members from parameters public RequestEvent(String EType,int ToArrive,Message m,DataHandler d) { // All members are from parent, hence "super" super.eventType = EType; super.arrivalTime = ToArrive; super.ID = m.getMsgID(); super.message = m; super.sortValue = ToArrive; super.Creator = d; super.next = null; this.spawn = true; } // Override the Base SimEvent Class' Execute with specific Execute // Instructions for an Arrival Type Event public void execute(EventQueue eventList, Stats stats, int Placeholder, RandNum randGen) { String ReportString = new String(); int Time, ToJoin, LeastLength; Time = stats.getGlobalTime(); // Spawn next Arrival Event (once) and put in Event Queue if (this.spawn) { this.spawn = false; RequestEvent newRE = Creator.genRequest(Time); eventList.enQueue(newRE); } writeExecute(stats.getGlobalTime(),stats); // Schedule Transmit Event from Client To Director TransferEvent newTE = Creator.genTransfer(Time,message); eventList.enQueue(newTE); } }