package dataStructures; /** *
Titulo: Uma implementaçao vectorial da Pilha Ilimitada
*Descrição: Esta implementaçao usa um vector de dimensão crescente
* @version 1.0 */ public class VStack implements Stack,Cloneable { private final int DELTA = 128; private Object[] theStack; private int theTop; public VStack() { theStack = new Object[DELTA]; theTop = -1; } public Stack empty() { return new VStack(); } public boolean isEmpty() { return theTop == -1; } /** * Increments the structure length (adds 'DELTA' new slots) */ private void grow() { Object[] newStack = new Object[theStack.length + DELTA]; for(int i=0;i