Class DataSource

java.lang.Object
  |
  +--DataSource

public class DataSource
extends java.lang.Object


Field Summary
static int NUMTESTS
           
 
Constructor Summary
DataSource(int dataSetSize, long rngSeed)
          Constructor will create two GWindows, one to show the data and one to show your result.
 
Method Summary
 java.util.ArrayList getDataList()
          Retrieves an ArrayList with data for this exercise.
 java.util.HashSet getDataSet()
          Retrieves a HashSet with data for this exercise.
 void registerResult(java.util.ArrayList resultList)
          Call this with your result list
 void startExercise(int testNum)
          Call this routine to indicate that you are starting a new exercise.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NUMTESTS

public static final int NUMTESTS
Constructor Detail

DataSource

public DataSource(int dataSetSize,
                  long rngSeed)
Constructor will create two GWindows, one to show the data and one to show your result. The object will then just sit there, waiting for you to make other calls to it.

The correct calling sequence is: startExercise( n ) (to indicate you want to start running exercise n) getDataSet() and/or getDataList() (to get the data to use in exercise n) registerResult() (to provide your ArrayList containing the rectanges in your result for exercise n)

Method Detail

startExercise

public void startExercise(int testNum)
Call this routine to indicate that you are starting a new exercise.

Parameters:
testNum - The integer number of the exercise you want to run.

getDataSet

public java.util.HashSet getDataSet()
Retrieves a HashSet with data for this exercise. (Call this routine only after you have called StartExercise() with the number of the exercise you want data for.)

Note that we create new Rectangles here, rather than simply providing references to the originals. This keeps your code from messing with the original data.


getDataList

public java.util.ArrayList getDataList()
Retrieves an ArrayList with data for this exercise. (Call this routine only after you have called StartExercise() with the number of the exercise you want data for.)

Note that we create new Rectangles here, rather than simply providing references to the originals. This keeps your code from messing with the original data.


registerResult

public void registerResult(java.util.ArrayList resultList)
Call this with your result list