public override void ActivateEvent(object eventPar) { //Gledamo izlaznu granu var outputEdge = OutEdges().ElementAt(1); if (outputEdge.Target.IsBusy) { throw new Exception("Output can't be blocked on generator."); } //Postavljamo trenutak proizvodnje sledeceg entiteta selfEdge.SetEvent(Simulator.Time + distribution.NextValue()); //Prosledjujemo entitet sledecem bloku Entity newEntity = EntityCreator(); outputEdge.SetEvent(Simulator.Time, newEntity); }
public override void ActivateEvent(object eventPar) { if (IsBusy) { if (eventPar != null) { throw new Exception("Service can't receive entities if it's busy."); } } else if (eventPar == null) { throw new Exception("Service can't be called without entity if it's not active. Possible couse: service was set as start event."); } //Pocetak servisiranja, ako je entitet != null if (eventPar != null) { double serviceTime = distribution.NextValue(); selfEdge.SetEvent(Simulator.Time + serviceTime); OnNotifyChanged(new DataPairArgs(Simulator.Time, serviceTime)); entity = eventPar; isProcessing = true; } else { //Kraj servisiranja, ako je entitet null var outputEdge = OutEdges().ElementAt(1); if (outputEdge.Target.IsBusy) { throw new Exception("Output can't be blocked on service."); } outputEdge.SetEvent(Simulator.Time, entity); //Izvrsavamo callback if (callbackEdge != null) { callbackEdge.SetEvent(Simulator.Time); } isProcessing = false; } }