public class Pile {
private int int_array[];
private int array_size;
- private int stack_head_index;
+ private int head_index;
/**
* set the size of the internal array
* @param int index the stack head index
*/
private void setHeadIndex(int index) {
- stack_head_index = index;
+ head_index = index;
}
/**
* @return the integer stack head index
*/
private int getHeadIndex() {
- return stack_head_index;
+ return head_index;
}
/**
*/
public void empiler(int value) {
if (!plein()) {
- int_array[stack_head_index] = value;
- stack_head_index++;
+ int_array[head_index] = value;
+ head_index++;
} else {
System.out.println("La pile est pleine");
}
*/
public int depiler() {
if (!vide()) {
- stack_head_index--;
- return int_array[stack_head_index];
+ head_index--;
+ return int_array[head_index];
} else {
return -1;
}