package vectorpkg;

/**
 * Title:
 * Description:
 * Copyright:    Copyright (c) 2002
 * Company:
 * @author
 * @version 1.0
 */

public class VectorAryMain {

  public static void main(String[] args) {
    // Testing constructor 3
    Object[] temp = {new Integer(1),new Integer(2),new Integer(3)};
    Vector v0 = new VectorAry(temp);
    System.out.println("v0 = " + v0); // v0 =[1,2,3]
    System.out.println("Size = " + v0.size() + " Capacity = " + v0.capacity());
      System.out.println(); // size = 3 capacity = 3
/*      //<1>
      System.out.println("1");
      Vector v1 = new VectorAry();  // v1 = [], size = 0, capacity = 10
      for(int k = 1; k <= 5; k++){
        v1.addElement(new Integer(k) );  // v1 = [1,2,3,4,5], size = 5
      }                                  // capacity = 10
      System.out.println("v1 = " + v1);
      System.out.println("Size = " + v1.size() + " Capacity = " + v1.capacity());
      System.out.println();

      //<2>
      System.out.println("2");
      Integer i = new Integer(3);
      System.out.println("indexOf(3) = " + v1.indexOf(i) +
                         "    indexOf(3,4) = " + v1.indexOf(i,4)); //2 -1
      System.out.println();

      //<3>
      System.out.println("3");
      System.out.println("contains(3) = " + v1.contains(i) +
                         "     lastIndexOf(3) = " + v1.lastIndexOf(i)); //true 2
      System.out.println();

      //<4>
      System.out.println("4");
      Vector v2 = new VectorAry(3,4); // v1 = [], size = 0, capacity = 3
      for(int k = 4; k <=8; k++)
        v2.addElement(new Integer(k));  // v2 = [4,5,6,7,8] size = 5
                                        // capacity = 7
      System.out.println("v2 = " + v2);
      System.out.println("Size = " + v2.size() + " Capacity = " + v2.capacity());
      System.out.println();

      //<5>
      System.out.println("5");
      v2.ensureCapacity(9); //v2 = 4,5,6,7,8], size = 5, capacity = 11
      System.out.println("Size = " + v2.size() + " Capacity = " + v2.capacity());
      System.out.println();

      //<6>
      System.out.println("6");
      Vector v3 = new VectorAry(2); // v3 = [], size = 0, capacity = 2
      System.out.println("v3 = " + v3);
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      //<7>
      System.out.println("7");
      v3.setSize(4); // v3 =        size=0 cap=4
      System.out.println("v3 = " + v3);
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      //<8>
      System.out.println("8");
      v3.addAll(temp);  //v3 = [1,2,3];
      System.out.println("v3 = " + v3);
      v3.setElementAt(new Integer(9), 0); //v3 = [9,2,3]
      System.out.println("v3 = " + v3);
      v3.setElementAt(new Integer(5), 1); //v3 = [9,5,3]
      System.out.println("v3 = " + v3);
      v3.addElement(0, v3.elementAt(1));  //v3 = [5,9,5,3]
                                          //size = 4, cap = 4
      System.out.println("v3 = " + v3);
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <9>
      System.out.println("9");
      v3.ensureCapacity(9); //v3 = [null,5,9,null,5],size = 5,cap = 9
      System.out.println("v3 = " + v3);
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <10>
      System.out.println("10");
      v3.removeElement(new Integer(9)); //// v3 = [null,5,null,5]
      System.out.println("v3 = " + v3);
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <11>
      System.out.println("11");
      v3.removeElementAt( v3.size()-2 );  // v3 = [null,5,5]
      System.out.println("v3 = " + v3);   // size = 3, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <12>
      System.out.println("12");
      System.out.println("Printing Copy");
      Object[] ary = v3.makeCopy();
      for(int k = 0; k < ary.length; k++)
        System.out.print(ary[k] + " ");
      System.out.println("\n");

      // <13>
      System.out.println("13");
      System.out.println("removeElementAt");
      v3.removeElementAt(0);  //v3 = [3]
      System.out.println("v3 = " + v3);  // size = 1, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <14>
      System.out.println("14");
      System.out.println("makeCopy and addAll");
      v3.addAll( v1.makeCopy() ); //v3 = [3,1,2,3,4,5]
      System.out.println("v3 = " + v3);  // size = 6, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <15>
      System.out.println("15");
      System.out.println("makeCopy and removeAll");
      v3.removeAll( v2.makeCopy() );
      System.out.println("v3 = " + v3);  // v3 = [3,1,2,3], size = 4, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <16>
      System.out.println("16");
      System.out.println("makeCopy and addAll");
      v3.addAll( 2, v1.makeCopy() ); // [3,1,1,2,3,4,5,2,3]
      System.out.println("v3 = " + v3);  // size = 9, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <17>
      System.out.println("17");
      System.out.println("makeCopy and retainAll");
      v3.retainAll( v2.makeCopy() ); // v2 = [ 4,5] = intersection(v3,v2)
      System.out.println("v3 = " + v3); // size = 2, cap = 16
      System.out.println("Size = " + v3.size() + " Capacity = " + v3.capacity());
      System.out.println();

      // <18>
      System.out.println("18");
      System.out.println("Printing sublist");
      Object[] ary2 = v1.subList(1,3);
      for(int k = 0; k < ary2.length; k++)
        System.out.print(ary2[k] + " ");  // ary = [2,3]
      System.out.println("\n");

      // <19>
      System.out.println("19");
      System.out.println("Constructor 4");
      Vector v4 = new VectorAry(ary2);
      System.out.println("v4 = " + v4);
      System.out.println("Size = " + v4.size() + " Capacity = " + v4.capacity());
      System.out.println();

      // <20>  Test any methods that have not been used above
  */
  }
}

