public void OnRequestHandled(object sender, RequestEventArg e)
        {
            CountHandledRequest++;
            CountRequestInSystem--;

            Statistics.WaitingTimeInSystem.Score(Time - e.TimeBorn);
        }
 public void GenerateNewRequest()
 {
     NextTimeForNewRequest = generator.NextIntervalTime;
     CountGeneratedRequest++;
     var args = new RequestEventArg(-1, NextTimeForNewRequest, CountGeneratedRequest);
     NewRequestEvent.Raise(this, args);
     TimeToNextRequestBorn = 0;
 }
 private void OnTickEvent(object sender, EventArgs e)
 {
     if (!IsFree)
     {
         if (processingRequest.ProcessingTime == currentRequestProcessingTime++)
         {
             var evetArgs = new RequestEventArg(
                 processingRequest.TimeBorn, 
                 processingRequest.ProcessingTime, 
                 processingRequest.CountInSystem
                 );
             RequestHandledEvent.Raise(this, evetArgs);
             Release();
         }
     }
 }
        private void OnNewRequest(object sender, RequestEventArg e)
        {
            Statistics.IntervalTime.Score(e.NextTimeForNewRequest);
            Request newRequest = MakeNewRequest(e);

            if (Configuration.Devices.ThereIsFreeDevice)
            {
                Configuration.Devices.TakeFreeDevice(newRequest);
                CountRequestInSystem++;
            }
            else if (!Configuration.Discipline.IsFull)
            {
                Configuration.Discipline.Put(newRequest);
                CountRequestInSystem++;
            }
            else
            {
                CountRejectedRequests++;
                Statistics.UpdateRelativeBandwidth(CountRejectedRequests, e.CountRequestsCaughtInSystem);
            }
        }
 private Request MakeNewRequest(RequestEventArg e)
 {
     int processingTime = Configuration.Generator.NextProcessingTime;
     Statistics.ServiceTime.Score(processingTime);
     return Request.New(Time, processingTime, e.CountRequestsCaughtInSystem);
 }
 private void OnRequestHandled(object sender, RequestEventArg e)
 {
     var handler = RequestHandledEvent;
     handler.Raise(sender, e);
 }