Example #1
0
        private int asignarCola(List <int[]> ids, ArregloCola <Pasajero> cola, int stopId)
        {
            int retorno    = -1;
            int auxRetorno = Contiene(ids, stopId);

            if (auxRetorno == -1)
            {
                for (int i = 0; i < cola.DarTamano() && retorno == -1; i++)
                {
                    if (!cola.colaEnUso(i))
                    {
                        cola.inicializarCola(i);
                        int[] auxAgrega = { stopId, i };
                        ids.Add(auxAgrega);
                        retorno = i;
                    }
                }
            }
            else
            {
                retorno = ids[auxRetorno][1];
            }

            return(retorno);
        }
Example #2
0
        private int asignarCola(List<int[]> ids, ArregloCola<Pasajero> cola, int stopId)
        {
            int retorno = -1;
            int auxRetorno = Contiene(ids, stopId);
            if (auxRetorno == -1)
            {
                for (int i = 0; i < cola.DarTamano() && retorno == -1; i++)
                {
                    if (!cola.colaEnUso(i))
                    {
                        cola.inicializarCola(i);
                        int[] auxAgrega = { stopId, i };
                        ids.Add(auxAgrega);
                        retorno = i;
                    }
                }
            }
            else
            {
                retorno = ids[auxRetorno][1];
            }

            return retorno;

        }