Class Driver

java.lang.Object
  extended by Driver

public class Driver
extends java.lang.Object


Nested Class Summary
static class Driver.QueueType
          The QueueType enum has the following values: ArrayBasedQueue ReferenceBasedQueue
static class Driver.TestType
          The TestType enum has the following values: AddIntegers RemoveIntegers AddAndDisplayStrings DisplayAndRemoveStrings
 
Constructor Summary
Driver()
           
 
Method Summary
static void clearRunTimes()
          This method clears the array of run times to all zeros
static QueueInterface<java.lang.Integer> createIntegerTestQueue(Driver.QueueType queueType, int firstNumber, int lastNumber)
          This method is called by the runTestCase() method to obtain an Integer test queue.
static QueueInterface<java.lang.String> createStringTestQueue(Driver.QueueType queueType, int firstString, int lastString)
          This method is called by the runTestCase() method to obtain an Integer test queue.
static long[] getRunTimes()
          This method returns the array of run times that was generated by the previous call to runTestCase()
static QueueInterface<java.lang.Integer> initializeIntegerTestQueue(QueueInterface<java.lang.Integer> testQueue, int firstNumber, int lastNumber)
          This method is called by the createIntegerTestQueue() method to initialize the test queue.
static QueueInterface<java.lang.String> initializeStringTestQueue(QueueInterface<java.lang.String> testQueue, int firstString, int lastString)
          This method is called by the createStringTestQueue() method to initialize the test queue.
static void main(java.lang.String[] args)
           
static void runTestCase(Driver.TestType testType, Driver.QueueType queueType)
          This method is called to run a particular test case on a queue type a total of ten times.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Driver

public Driver()
Method Detail

getRunTimes

public static long[] getRunTimes()
This method returns the array of run times that was generated by the previous call to runTestCase()

Returns:
the runTime array.

clearRunTimes

public static void clearRunTimes()
This method clears the array of run times to all zeros


initializeIntegerTestQueue

public static QueueInterface<java.lang.Integer> initializeIntegerTestQueue(QueueInterface<java.lang.Integer> testQueue,
                                                                           int firstNumber,
                                                                           int lastNumber)
This method is called by the createIntegerTestQueue() method to initialize the test queue. The test queue could either be an ArrayQueue or a LinkedQueue. In either case, it will implement the QueueInterface.

Parameters:
testQueue - The testQueue to be initialized.
firstNumber - The first number to be added to the queue.
lastNumber - The last number to be added to the queue.
Returns:
The initialized test queue.
See Also:
createIntegerTestQueue(Driver.QueueType, int, int)

createIntegerTestQueue

public static QueueInterface<java.lang.Integer> createIntegerTestQueue(Driver.QueueType queueType,
                                                                       int firstNumber,
                                                                       int lastNumber)
This method is called by the runTestCase() method to obtain an Integer test queue. The test queue could either be an ArrayQueue or a LinkedQueue. In either case, it will implement the QueueInterface.

Parameters:
queueType - The type of queue needed. This can either be an ArrayQueue or a LinkedQueue.
firstNumber - The first number to be added to the queue.
lastNumber - The last number to be added to the queue.
Returns:
The created and initialized test queue.

initializeStringTestQueue

public static QueueInterface<java.lang.String> initializeStringTestQueue(QueueInterface<java.lang.String> testQueue,
                                                                         int firstString,
                                                                         int lastString)
This method is called by the createStringTestQueue() method to initialize the test queue. The test queue could either be an ArrayQueue or a LinkedQueue. In either case, it will implement the QueueInterface.

Parameters:
testQueue - The testQueue to be initialized.
firstString - The number of the first String to be added to the queue.
lastString - The number of the last String to be added to the queue.
Returns:
The initialized test queue.
See Also:
createStringTestQueue(Driver.QueueType, int, int)

createStringTestQueue

public static QueueInterface<java.lang.String> createStringTestQueue(Driver.QueueType queueType,
                                                                     int firstString,
                                                                     int lastString)
This method is called by the runTestCase() method to obtain an Integer test queue. The test queue could either be an ArrayQueue or a LinkedQueue. In either case, it will implement the QueueInterface.

Parameters:
queueType - The type of queue needed. This can either be an ArrayQueue or a LinkedQueue.
firstString - The number of the first String to be added to the queue.
lastString - The number of the last String.
Returns:
The created and initialized test queue.

runTestCase

public static void runTestCase(Driver.TestType testType,
                               Driver.QueueType queueType)
This method is called to run a particular test case on a queue type a total of ten times. The run time for each run is saved in the runTimes array.

Parameters:
testType - The type of test case being run. The choices are:
  1. AddIntegers
  2. RemoveIntegers
  3. AddAndDisplayStrings
  4. DisplayAndRemoveStrings
queueType - The type of queue needed. The choices are:
  1. ArrayBasedQueue
  2. ReferenceBasedQueue

main

public static void main(java.lang.String[] args)