Ejemplo n.º 1
0
        public int pop()
        {
            int aux = topo.getData();

            topo = topo.getNext();
            return(aux);
        }
        public String pop()
        {
            if (isEmpty())
            {
                throw new Exception();
            }
            String aux = topo.getData();

            topo = topo.getNext();
            return(aux);
        }
Ejemplo n.º 3
0
        public int pop()
        {
            if (isEmpty())
            {
                throw new Exception();
            }
            int aux = topo.getData();

            topo = topo.getNext();
            return(aux);
        }
Ejemplo n.º 4
0
        public string print()
        {
            string resultado = "";

            if (!isEmpty())
            {
                NohPilha aux = topo;
                while (aux != null)
                {
                    resultado += aux.getData() + "\r\n";
                    aux        = aux.getNext();
                }
            }
            return(resultado);
        }
Ejemplo n.º 5
0
 public void print()
 {
     if (isEmpty())
     {
         Console.WriteLine("Pilha Vazia");
     }
     else
     {
         Console.WriteLine("Status Atual da Pilha");
         NohPilha aux = topo;
         while (aux != null)
         {
             Console.WriteLine(aux.getData());
             aux = aux.getNext();
         }
     }
 }
Ejemplo n.º 6
0
        public string inversePrint()
        {
            List <int> resultados = new List <int>();
            string     resultado  = "";
            NohPilha   aux        = topo;

            while (aux != null)
            {
                resultados.Add(aux.getData());
                aux = aux.getNext();
            }
            resultados.Reverse();
            for (int i = 0; i < resultados.Count; i++)
            {
                resultado += resultados[i] + "\r\n";
            }
            return(resultado);
        }
Ejemplo n.º 7
0
        public int indexOf(int button)
        {
            int resultado = -1;
            int a         = 0;

            if (!isEmpty())
            {
                NohPilha aux = topo;
                while (aux != null)
                {
                    if (aux.getData() == button)
                    {
                        resultado = a;
                    }

                    aux = aux.getNext();
                    a++;
                }
            }
            return(resultado);
        }
Ejemplo n.º 8
0
        public int maior()
        {
            int maior;

            if (!isEmpty())
            {
                NohPilha aux = topo;
                maior = aux.getData();
                while (aux != null)
                {
                    if (maior < aux.getData())
                    {
                        maior = aux.getData();
                    }
                    aux = aux.getNext();
                }
            }
            else
            {
                throw new Exception();
            }
            return(maior);
        }
 public NohPilha()
 {
     data    = "";
     nextNoh = null;
 }
 public NohPilha(String valor)
 {
     data    = valor;
     nextNoh = null;
 }
 public NohPilha(TAD valor)
 {
     data    = valor;
     nextNoh = null;
 }
 public NohPilha()
 {
     nextNoh = null;
 }
Ejemplo n.º 13
0
 public Pilha()
 {
     topo = null;
 }
Ejemplo n.º 14
0
 public void push(int valor)
 {
     topo = new NohPilha(valor, topo);
     count++;
 }
 public NohPilha(TAD valor, NohPilha <TAD> noh)
 {
     data    = valor;
     nextNoh = noh;
 }
Ejemplo n.º 16
0
 public NohPilha(int valor)
 {
     data    = valor;
     nextNoh = null;
 }
 public void push(String valor)
 {
     topo = new NohPilha(valor, topo);
 }
 public NohPilha(String valor, NohPilha noh)
 {
     data    = valor;
     nextNoh = noh;
 }
Ejemplo n.º 19
0
 public NohPilha(int valor, NohPilha noh)
 {
     data    = valor;
     nextNoh = noh;
 }
 public void setNext(NohPilha nextNoh)
 {
     this.nextNoh = nextNoh;
 }
Ejemplo n.º 21
0
 public void push(TAD valor)
 {
     topo = new NohPilha <TAD>(valor, topo);
 }