1: import java.util.Vector; 2: /** 3: A class of stacks whose entries are stored in a vector. 4: @author Frank M. Carrano and Timothy M. Henry 5: @version 5.0 6: */ 7: public final class VectorStack<T> implements StackInterface<T> 8: { 9: private Vector<T> stack; // Last element is the top entry in stack 10: private boolean integrityOK; 11: private static final int DEFAULT_CAPACITY = 50; 12: private static final int MAX_CAPACITY = 10000; 13: 14: public VectorStack() 15: { 16: this(DEFAULT_CAPACITY); 17: } // end default constructor 18: 19: public VectorStack(int initialCapacity) 20: { 21: integrityOK = false; 22: checkCapacity(initialCapacity); 23: stack = new Vector<>(initialCapacity); // Size doubles as needed 24: integrityOK = true; 25: } // end constructor 26: 27: // < Implementations of checkIntegrity, checkCapacity, and the stack 28: // operations go here. > 29: // . . . 30: } // end VectorStack