/**
 *  Abstract benchmark object (one test algorithm).
 *   @author  Josef.Pelikan@mff.cuni.cz
 *   @version 0.007 (2001/06/16)
 *   @since   0.007
 */
public abstract class Benchmark {

    /**
     *  Test (benchmark) ordinal number.
     *   @return Ordinal number of the test.
     */
    public int testNumber () {
        return -1;
    }

    /**
     *  The benchmark algorithm itself. Needs not be re-entrant but can be iterated.
     */
    abstract protected void test ();

    /**
     *  Runs the test algorithm.
     *   @return Number of milliseconds.
     */
    public long runTest () {
        long startTime = System.currentTimeMillis();
        test();
        long stopTime = System.currentTimeMillis();
        return( stopTime - startTime );
    }

    /**
     *  Result string of the test. Should be called after the <code>runTest()</code>
     *  was finished.
     *   @return Result of the test.
     */
    public String testResult () {
        return null;
    }

}
