// The structure package contains the definition of the Vector class
import structure.*;

class MoreVectorTest
{
	protected static void printVector(Vector x, int n)
	{
		for(int i = 0; i < n; i++)
		{
			System.out.print(x.get(i));
			System.out.print(" ");
		}
		System.out.println();
	}
		
	public static void main(String[] args)
	{
		// Defines x as a reference/pointer to a Vector object
		Vector x;
	
		// Allocates space for x by calling a constructor in
		// the Vector class that takes a single argument that
		// specifies the initial capacity of the Vector.
		x = new Vector(10);
		
		// What is the size of the Vector
		System.out.println(x.size());

		// The Vector class contains a method called add that
		// appends to the end of the Vector. So the class keeps
		// track of the end for us.
		x.add("10");
		x.add("12");
		x.add("14");

		// What is the size of the Vector?
		System.out.print("The size of the vector is ");
		System.out.println(x.size());
		printVector(x, 10);

		// This example shows that slots that are beyond the end of
		// the array can also be set. Is this good or bad?
		Object y = x.set(5, "1000");
		// What is the size of the Vector now?
		System.out.print("The size of the vector is ");
		System.out.println(x.size());
		printVector(x, 10);

		y = x.remove();
		// What is y?
		System.out.println("This is what is removed.");
		System.out.println(y);
		// What is the size of the Vector now?
		System.out.print("The size of the vector is ");
		System.out.println(x.size());
		printVector(x, 10);

		// This example shows that if there an multiple copies of an
		// object, then when remove is used, the first copy of
		// that object is removed from the Vector.
		x.add("10");
		y = x.remove("10");
		System.out.println("This is what is removed.");
		System.out.println(y);
		// What is the size of the Vector now?
		System.out.print("The size of the vector is ");
		System.out.println(x.size());
		printVector(x, 10);
	}
}
