Exemplo n.º 1
0
 public void setHorario(string label, Dia desc)
 {
     if (horario == null)
     {
         horario = new Dictionary <string, Dia>();
     }
     horario.Add(label, desc);
 }
Exemplo n.º 2
0
        //void probar(List<Salon> aulas, Materia mat)
        void probar(Materia mat)
        {
            int i;

            foreach (Salon aula in aulas)
            {
                if (aula.capacidad < mat.cupo)
                {
                    continue;
                }

                var ha = aula.horario;
                if (ha == null)
                {
                    aula.horario = new Dictionary <string, Dia>();
                    ha           = aula.horario;
                }
                var cha = ha.Keys.ToList();

                var hm = mat.horario;

                var chm = hm.Keys.ToList();

                foreach (string key in chm)
                {
                    Dia da = new Dia();
                    Dia dm = new Dia();

                    if (!hm.TryGetValue(key, out dm))
                    {
                        dm = new Dia();
                    }

                    if (!ha.TryGetValue(key, out da))
                    {
                        //NO habia anda en ese dia en el aula
                        mat.horario.Remove(key);
                        aula.horario.Add(key, dm);
                        continue;
                    }

                    if (da.traslapar(dm))
                    {
                        da.empalmar(dm);
                        mat.horario.Remove(key);
                    }
                }
                if (mat.horario.Count > 0)
                {
                    mat.intentos++;
                    mat.completado = false;
                }
                else
                {
                    mat.completado = true;
                }
            }
        }
Exemplo n.º 3
0
 public void empalmar(Dia otro)
 {
     for (int i = 0; i < 24; i++)
     {
         if (otro.horas[i] != null)
         {
             this.horas[i] = otro.horas[i];
         }
     }
 }
Exemplo n.º 4
0
 public bool traslapar(Dia otro)
 {
     for (int i = 0; i < 24; i++)
     {
         if (otro.horas[i] != null && this.horas[i] != null)
         {
             return(false);
         }
     }
     return(true);
 }
Exemplo n.º 5
0
        public Dia getHorario(string label)
        {
            if (horario == null)
            {
                horario = new Dictionary <string, Dia>();
            }
            Dia temp = new Dia();

            if (horario.TryGetValue(label, out temp))
            {
                return(temp);
            }
            return(null);
        }
Exemplo n.º 6
0
        public void setHorario(string dia, string cadena)
        {
            if (horario == null)
            {
                horario = new Dictionary <string, Dia>();
            }
            if (cadena.Length == 0)
            {
                return;
            }
            Dia d = new Dia(cadena, dia, this.clave);

            horario.Add(dia, d);
        }