Exemplo n.º 1
0
 public Hilo(Reloj reloj, Parking parking, char tipo, Func <long, int> accion,
             double t1_sig, double t2_sig, double t1_out, double t2_out)
 {
     this.reloj   = reloj;
     this.parking = parking;
     this.tipo    = tipo;
     this.accion  = accion;
     this.t1_sig  = t1_sig;
     this.t2_sig  = t2_sig;
     this.t1_out  = t1_out;
     this.t2_out  = t2_out;
 }
Exemplo n.º 2
0
 public Parking(Reloj reloj, char[] plazas)
 {
     this.reloj  = reloj;
     this.plazas = plazas;
     this.size   = plazas.Length;
     this.count  = 0;
     for (int i = 0; i < size; i++)
     {
         if (this.plazas[i] != '_')
         {
             this.count++;
         }
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("INICIO");
            Reloj r = new Reloj();

            //Vecinos:6, Trabajadores:2, Otros:1, _vacio:3 = 12 plazas
            char[]  plazas = "VVVVVVTTO___".ToCharArray();
            Parking p = new Parking(r, plazas);
            Hilo    trabajadores, vecinos, otros;

            trabajadores = new Hilo(r, p, 'T', A.Trabajador, 2, 8, 0.25, 1);
            vecinos      = new Hilo(r, p, 'V', A.Vecino, 5, 15, 1, 10);
            otros        = new Hilo(r, p, 'O', A.Otro, 5, 15, 1, 6);
            trabajadores.Empieza();
            vecinos.Empieza();
            otros.Empieza();
            trabajadores.Termina();
            vecinos.Termina();
            otros.Termina();
            Console.WriteLine("FIN");
        }