Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
public class Pile<E> {
private E[] array;
private int array_size;
public class Pile<E> {
private E[] array;
private int array_size;
- private int stack_head_index;
+ private int head_index;
/**
* set the size of the internal array
/**
* set the size of the internal array
* @param int index the stack head index
*/
public void setHeadIndex(int index) {
* @param int index the stack head index
*/
public void setHeadIndex(int index) {
- stack_head_index = index;
* @return the integer stack head index
*/
public int getHeadIndex() {
* @return the integer stack head index
*/
public int getHeadIndex() {
- return stack_head_index;
*/
public void empiler(E value) {
if (!plein()) {
*/
public void empiler(E value) {
if (!plein()) {
- array[stack_head_index] = value;
- stack_head_index++;
+ array[head_index] = value;
+ head_index++;
} else {
System.out.println("La pile est pleine");
}
} else {
System.out.println("La pile est pleine");
}
*/
public E depiler() {
if (!vide()) {
*/
public E depiler() {
if (!vide()) {
- stack_head_index--;
- return array[stack_head_index];
+ head_index--;
+ return array[head_index];