/* * Timer.java * * Created on April 12, 2005, 10:29 PM */ package sorttimer; /** * * @author levenick */ public class SortTimer { AbstractSort theSort; IntList theList; /** Creates a new instance of Timer */ public SortTimer(AbstractSort theSort, IntList theList) { this.theSort = theSort; this.theList = theList; } public String time() { long before = System.currentTimeMillis(); theSort.sort(theList) ; long after = System.currentTimeMillis(); long elapsedTime = after - before; return theSort.toString() + " n=" + theList.length() + " msec=" + elapsedTime; } }