org.terrier.utility
Class TerrierTimer

java.lang.Object
  extended by java.lang.Thread
      extended by org.terrier.utility.TerrierTimer
All Implemented Interfaces:
Runnable

public class TerrierTimer
extends Thread

This class implements a timer.


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
protected  double done
          Number of items in task completed
protected  short lastPercentage
          the last percentage that was output.
protected  String message
          the message that should be output with the progress
protected  long startingTime
          The starting system time in millisecond.
protected  double total
          The total number of items to process in a task.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
TerrierTimer()
           
TerrierTimer(String message, double total)
           
 
Method Summary
 String elapsed()
          Get a string summarising the processing/remaining time in minutes and seconds.
 void finished()
           
 short getPercentage()
           
 String getRemainingTime()
           
 void increment()
           
 void increment(double dIncrememt)
           
static String longToText(long timems)
           
 void run()
           
 void setDone(double done)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

startingTime

protected final long startingTime
The starting system time in millisecond.


total

protected final double total
The total number of items to process in a task.


done

protected volatile double done
Number of items in task completed


lastPercentage

protected short lastPercentage
the last percentage that was output. Set to a negative value, so that a value is always determined


message

protected final String message
the message that should be output with the progress

Constructor Detail

TerrierTimer

public TerrierTimer()

TerrierTimer

public TerrierTimer(String message,
                    double total)
Method Detail

setDone

public void setDone(double done)

getPercentage

public short getPercentage()

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread

increment

public void increment()

increment

public void increment(double dIncrememt)

finished

public void finished()

getRemainingTime

public String getRemainingTime()

elapsed

public String elapsed()
Get a string summarising the processing/remaining time in minutes and seconds.


longToText

public static String longToText(long timems)


Terrier 3.6. Copyright © 2004-2011 University of Glasgow