Ejemplo n.º 1
0
        public T rechercheContent(T content)
        {
            T returnedElement = null;
            ElementPile <T> currentElementPile = null;
            Boolean         isFind             = false;

            if (taille > 0)
            {
                currentElementPile = this.nextPile;

                if (currentElementPile.compare(content))
                {
                    isFind          = true;
                    returnedElement = currentElementPile.getContent();
                }

                for (int i = 2; i <= taille; i++)
                {
                    if (!isFind)
                    {
                        currentElementPile = currentElementPile.getElement();

                        if (currentElementPile.compare(content))
                        {
                            isFind          = true;
                            returnedElement = currentElementPile.getContent();
                        }
                    }
                }
            }

            return(returnedElement);
        }
Ejemplo n.º 2
0
        public override string ToString()
        {
            string returnString = "{ ";

            if (taille > 0)
            {
                ElementPile <T> currentElementPile = this.nextPile;
                returnString += currentElementPile.getContent().ToString();

                for (int i = 2; i <= taille; i++)
                {
                    currentElementPile = currentElementPile.getElement();
                    returnString      += " " + currentElementPile.getContent().ToString();
                }
            }

            return(returnString + " }");
        }