// arrivalEvent.cc: the Arrival class.
// (modified from arrival.cc)

#include <math.h>
#include "supermarket.h"
#include "arrivalEvent.h"


double ArrivalEvent::interarrivalTime () {
   // CODE: must change distribution here
   return sim->getMeanInterarrivalTime();
}

void ArrivalEvent::makeItHappen () {
   // Create and initialize a new customer record.
   Cust *arrivingCust = new Cust ();
   sim->newCustomerArrival();

   arrivingCust->setArrivalTime (sim->getTime());
   // send customer to a cashier queue
   sim->sendCustomerToCashierStand(arrivingCust); 

   // Schedule the next arrival, reusing the current event object.
   setTime (sim->getTime() + interarrivalTime());
   sim->insertEvent (this);   
}
