コード例 #1
0
        public void Eliminar(string nombre)
        {
            Bases temp = inicio;

            if (temp.nombre == nombre)
            {
                if (temp.siguiente == inicio)
                {
                    inicio = null;
                }
                else
                {
                    while (temp.siguiente != inicio)
                    {
                        temp = temp.siguiente;
                    }

                    temp.siguiente = inicio.siguiente;
                    inicio         = inicio.siguiente;
                }
            }
            else
            {
                while (temp.siguiente != inicio && temp.siguiente.nombre != nombre)
                {
                    temp = temp.siguiente;
                }

                if (temp.siguiente.nombre == nombre)
                {
                    temp.siguiente = temp.siguiente.siguiente;
                }
            }
        }
コード例 #2
0
        public void AgregarInicio(Bases nueva)
        {
            Bases temp = inicio;

            if (inicio == null)
            {
                inicio          = nueva;
                nueva.siguiente = inicio;
            }
            else
            {
                Buscar(nueva.nombre);
                if (encontrado != true)
                {
                    while (temp.siguiente != inicio)
                    {
                        temp = temp.siguiente;
                    }

                    nueva.siguiente = inicio;
                    inicio          = nueva;
                    temp.siguiente  = inicio;
                }
            }
        }
コード例 #3
0
        public Bases Buscar(string nombre)
        {
            Bases temp = inicio;

            encontrado = false;

            while (temp.siguiente != inicio && temp.nombre != nombre)
            {
                temp = temp.siguiente;
            }

            if (temp.nombre == nombre)
            {
                encontrado = true;
            }

            if (encontrado == true)
            {
                return(temp);
            }
            else
            {
                return(null);
            }
        }
コード例 #4
0
        public void Insertar(string nombre, Bases nueva)
        {
            Bases temp = Buscar(nombre);

            nueva.siguiente = temp.siguiente;
            temp.siguiente  = nueva;
        }
コード例 #5
0
        public string Recorrido(string nombre, int tInicio, int tFinal)
        {
            Bases  temp = Buscar(nombre), auxiliar = Buscar(nombre);
            string cadena = "";

            while (temp.siguiente != auxiliar)
            {
                cadena += temp.nombre + "        ";
                temp    = temp.siguiente;
            }

            cadena  += Convert.ToString(temp.nombre);
            temp     = temp.siguiente;
            tInicio -= Convert.ToInt32(temp.minutos);

            while (tInicio <= tFinal)
            {
                tInicio += Convert.ToInt32(temp.minutos);
                if (temp == auxiliar)
                {
                    cadena += Environment.NewLine;
                }

                cadena += tInicio.ToString("0000") + " ";
                temp    = temp.siguiente;
            }

            return(cadena);
        }
コード例 #6
0
ファイル: Form1.cs プロジェクト: Werto300/Bases-Rutas
        private void btnBuscar_Click(object sender, EventArgs e)
        {
            Bases busqueda = rutas.Buscar(txtBuscar.Text);

            if (busqueda != null)
            {
                txtReportOpe.Text  = "Nombre: " + Convert.ToString(busqueda.nombre) + Environment.NewLine;
                txtReportOpe.Text += "Tiempo: " + Convert.ToString(busqueda.minutos) + Environment.NewLine;
            }
        }
コード例 #7
0
        public void EliminarFinal()
        {
            Bases temp = inicio;

            if (temp.siguiente == inicio)
            {
                inicio = null;
            }
            else
            {
                while (temp.siguiente.siguiente != inicio)
                {
                    temp = temp.siguiente;
                }

                temp.siguiente = inicio;
            }
        }
コード例 #8
0
        public string Reporte()
        {
            string cadena = "";
            Bases  temp   = inicio;

            if (temp != null)
            {
                while (temp.siguiente != inicio)
                {
                    cadena += temp.ToString();
                    temp    = temp.siguiente;
                }

                cadena += temp.ToString();
                return(cadena);
            }
            else
            {
                return("");
            }
        }
コード例 #9
0
ファイル: Form1.cs プロジェクト: Werto300/Bases-Rutas
 private void btnInsertar_Click(object sender, EventArgs e)
 {
     rutas.Insertar(txtInsertar.Text, bases = new Bases(txtInsertar.Text, Convert.ToInt32(txtAgregTiempIni.Text)));
 }
コード例 #10
0
ファイル: Form1.cs プロジェクト: Werto300/Bases-Rutas
 private void btnAgregInicio_Click(object sender, EventArgs e)
 {
     rutas.AgregarInicio(bases = new Bases(txtNombreAgregInicio.Text, Convert.ToInt32(txtAgregTiempIni.Text)));
     txtNombreAgregInicio.Clear(); txtAgregTiempIni.Clear();
 }