stresstests.datasets
Class TraversalALC<T>

java.lang.Object
  extended by stresstests.datasets.TraversalALC<T>
All Implemented Interfaces:
Traversal<T>

public class TraversalALC<T>
extends java.lang.Object
implements Traversal<T>

A non-mutable iterator wrapper for ArrayList TraversalALC 22 March 2006

Author:
Viera K. Proulx

Field Summary
(package private)  java.util.ArrayList<T> cities
           
(package private)  int index
           
 
Constructor Summary
TraversalALC(java.util.ArrayList<T> cities)
          Constructor - save the data to traverse
TraversalALC(java.util.ArrayList<T> cities, int index)
          Constructor - save the data to traverse using the data from the given ArrayList> starting at the given index
 
Method Summary
 T getFirst()
          produce the first data element in the current Traversal
 Traversal<T> getRest()
          produce the Traversal for the rest of the data
 boolean isEmpty()
          test whether there are more items to traverse
static void main(java.lang.String[] argv)
          Self Test
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cities

java.util.ArrayList<T> cities

index

int index
Constructor Detail

TraversalALC

public TraversalALC(java.util.ArrayList<T> cities,
                    int index)
Constructor - save the data to traverse using the data from the given ArrayList> starting at the given index


TraversalALC

public TraversalALC(java.util.ArrayList<T> cities)
Constructor - save the data to traverse

Method Detail

getRest

public Traversal<T> getRest()
produce the Traversal for the rest of the data

Specified by:
getRest in interface Traversal<T>
Returns:
the Traversal for the rest of this dataset if available -- otherwise throws IllegalUseOfTraversalException

getFirst

public T getFirst()
produce the first data element in the current Traversal

Specified by:
getFirst in interface Traversal<T>
Returns:
the first element if available -- otherwise throws IllegalUseOfTraversalException

isEmpty

public boolean isEmpty()
test whether there are more items to traverse

Specified by:
isEmpty in interface Traversal<T>
Returns:
true if the dataset is empty

main

public static void main(java.lang.String[] argv)
Self Test