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); }
public ElementPile <T> Depiler() { ElementPile <T> returnedElement = null; if (taille > 0) { returnedElement = this.nextPile; this.nextPile = returnedElement.getElement(); taille--; } return(returnedElement); }
public Boolean Empiler(T newContent) { Boolean isAdded = false; if (!this.isPleine()) { this.nextPile = new ElementPile <T>(this.nextPile, newContent); isAdded = true; taille++; } return(isAdded); }
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 + " }"); }
public void ViderPile() { this.nextPile = null; this.taille = 0; }
public ElementPile(ElementPile <T> element, T content) { this.element = element; this.content = content; }