BRUtil - Making Java a Kinder, Gentler, Place to be.

brutil
Class MapTestResults

java.lang.Object
  |
  +--brutil.MapTestResults

public class MapTestResults
extends java.lang.Object

It performs unit timing tests using a HighResTimer upon the get, put, and remove methods. After having gathered timings, there are math utilities to perform basic analysis on the data collected.


Field Summary
static boolean FULLOUTPUT
           
static boolean OUTPUT
           
 
Constructor Summary
MapTestResults(Map map, brutil.timing.HighResTimer timer, int numElements, int randomSeed)
          Constructs a MapTestResults using the Map, HighResTimer, number of Elements, and specified Random seed
 
Method Summary
 void createRandoms()
          Initializes the set of testing keys with random data
 void createSequential()
          Initializes the set of testing keys with sequential data
 void doGets(int startIndex, int endIndex)
          Performs timings on the get method of the Map.
 void doMath()
          Performs basic mathematical analysis on the data collected.
 void doPuts(int startIndex, int endIndex, java.lang.Object data)
          Performs timings on the put method of the Map.
 void doRemoves(int startIndex, int endIndex)
          Performs timings on the remove method of the Map.
 void initialize()
          Performs a put followed by a remove on the Map.
 void setMap(Map m)
          Resets the MapTestResults to use the specified Map and clears any stored timing data
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

OUTPUT

public static boolean OUTPUT

FULLOUTPUT

public static boolean FULLOUTPUT
Constructor Detail

MapTestResults

public MapTestResults(Map map,
                      brutil.timing.HighResTimer timer,
                      int numElements,
                      int randomSeed)
Constructs a MapTestResults using the Map, HighResTimer, number of Elements, and specified Random seed
Parameters:
map - - The Map on which to perform timing tests
timer - - the HighResTimer to use
numElements - - the number of Elements in the Map
randomSeed - - the number with which to seed the Random number generator. To use the same set of random numbers, use the same seed.
Method Detail

initialize

public void initialize()
Performs a put followed by a remove on the Map. Leads to better Map health during timing runs.

setMap

public void setMap(Map m)
Resets the MapTestResults to use the specified Map and clears any stored timing data

createRandoms

public void createRandoms()
Initializes the set of testing keys with random data

createSequential

public void createSequential()
Initializes the set of testing keys with sequential data

doPuts

public void doPuts(int startIndex,
                   int endIndex,
                   java.lang.Object data)
Performs timings on the put method of the Map.
Parameters:
startIndex - - the starting index to be used by the timing tests
endIndex - - the ending index to be used by the timing tests
data - - the Object to put into the Map

doGets

public void doGets(int startIndex,
                   int endIndex)
Performs timings on the get method of the Map.
Parameters:
startIndex - - the starting index to be used by the timing tests
endIndex - - the ending index to be used by the timing tests

doRemoves

public void doRemoves(int startIndex,
                      int endIndex)
Performs timings on the remove method of the Map.
Parameters:
startIndex - - the starting index to be used by the timing tests
endIndex - - the ending index to be used by the timing tests

doMath

public void doMath()
Performs basic mathematical analysis on the data collected. Calculates the max timing value, the average timing value, and the ration of max to average. These values are stored internally.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
- a string representation of the MapTestResults data


BRUtil - Making Java a Kinder, Gentler, Place to be.