/* * interface ObjectVectorInterface * * Created on May 24, 2007 * * by Donald Yessick */ /** * @author Donald Yessick * */ public interface CS220_Vector_Interface { /** * add item to vector, resize vector if required * @param object */ void add(Object object); /** * insert object at index, resize vector if required * @param object to be added * @param index at which to insert object */ void insert(Object object, int index); /** * store object at index, replaces previous contents * @param object to be stored * @param index at which to insert object */ void store(Object object, int index); /** * retrieve object at target index * @param index of target * @return target object */ Object retrieve(int index); /** * setCapacity allows user to resize vector (possibly truncating) * @param newCapacity specifies size */ void setCapacity(int newCapacity); /** * getCount return number of elements added or inserted * @return size of filled vector */ int getCount(); /** * getCapacity returns allocated size of vectors internal array * @return length of internal array */ int getCapacity(); /** * visit each element using the visitor design pattern * visit * @param v the visitor implementing a visit(object) method */ void visit(CS220_Visitor_Interface v); }