Algorithm
Development Kit 1.0

algs.model.tests.common
Class TrialSuite

java.lang.Object
  extended by algs.model.tests.common.TrialSuite

public class TrialSuite
extends java.lang.Object

Represents a suite of timed trials.

Automatically throws away the lowest and highest of all trials sizes when computing the average.

Since:
1.0
Version:
1.0, 6/15/08
Author:
George Heineman

Constructor Summary
TrialSuite()
           
 
Method Summary
 void addTrial(long n, long startTime, long endTime)
          Record the timing of a trial of size n that started at startTime and completed at endTime.
 java.lang.String computeTable()
          Produce full table of information.
 java.lang.String getAverage(long n)
          Return a single average, if it exists in the table.
 java.lang.String getRow(long n)
          Return a single row, if it exists in the table.
 java.lang.String histogram()
           
 java.util.Iterator<java.lang.Long> keys()
          Expose the set of keys maintained by the table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrialSuite

public TrialSuite()
Method Detail

keys

public java.util.Iterator<java.lang.Long> keys()
Expose the set of keys maintained by the table.


getAverage

public java.lang.String getAverage(long n)
Return a single average, if it exists in the table.

Parameters:
n - the desired row.

getRow

public java.lang.String getRow(long n)
Return a single row, if it exists in the table.

Parameters:
n - the desired row.

computeTable

public java.lang.String computeTable()
Produce full table of information.


histogram

public java.lang.String histogram()

addTrial

public void addTrial(long n,
                     long startTime,
                     long endTime)
Record the timing of a trial of size n that started at startTime and completed at endTime.

Parameters:
n -
startTime -
endTime -

Algorithm Development Kit 1.0

This code supports the Algorithms in a Nutshell book, published by O'Reilly Media, Inc. in November 2008. Please visit the book web page to learn of any changes to the code repository or to record a potential defect.