Esempio n. 1
0
        public void wykonajZdarzenie()
        {
            zdarzenia.Sort(
                delegate(Zdarzenie a, Zdarzenie b)
            {
                return(a.getCzas().CompareTo(b.getCzas()));
            });


            zegar = zdarzenia[0].getCzas();
            typZdarzenia tmp = zdarzenia[0].getTyp();

            if (zdarzenia[0].getTyp() == typZdarzenia.przyjscie) // przyjscie
            {
                Console.WriteLine("Przyjscie do wezla " + id + " zegar: " + zegar);
                zdarzeniePrzyjscia();
            }
            else if (zdarzenia[0].getTyp() == typZdarzenia.obsluzenie) // obsluzenie
            {
                Console.WriteLine("Obsluga w wezle " + id + " zegar: " + zegar);
                zdarzenieObslugi();
            }

            Program.zapiszDoPliku(zapisz(tmp), "symulacja.txt");
            if (przeslijTMP == true)
            {
                Program.przekazPakiet(obslugiwanyTMP, zegarTMP);
                przeslijTMP = false;
            }
        }
Esempio n. 2
0
        public string zapisz(typZdarzenia typ)
        {
            string gap = "       ";

            if (typ == typZdarzenia.obsluzenie)
            {
                return(id + gap + typ + gap + zegar + gap + liczbaPakietow() + gap + zajety + gap + aktywny.getTypRuchu() + gap + aktywny.getOpoznienie());
            }
            else
            {
                return(id + gap + typ + gap + zegar + gap + liczbaPakietow() + gap + zajety + gap + aktywny.getTypRuchu());
            }
        }
 public Zdarzenie(typZdarzenia typ, double czas)
 {
     this.typ  = typ;
     this.czas = czas;
 }