lcanals.tc.core
Class Timing

java.lang.Object
  |
  +--lcanals.tc.core.Timing
All Implemented Interfaces:
java.io.Serializable

public class Timing
extends java.lang.Object
implements java.io.Serializable

Information about the use of the time for a task

Author:
www.lfcanals.es.org
See Also:
Serialized Form

Constructor Summary
Timing(int id)
          Builds an empty new timing
 
Method Summary
 java.util.Iterator getBreaksIterator()
          Return an iterator over the list of breaks till the moment
 boolean isInPause()
          Says if timing is in pause (started, paused, but not stopped)
 boolean isStarted()
          Says if timing is started but not stopped yet
 boolean isStopped()
          Says if timing is stopped
 void pause(java.lang.String description)
          Pauses the timing, signaling a break
 float performance()
          Return the current calculated performance according to the current breaks.
 long projectTime()
          Returns the spent time for this timing (without breaks) in milliseconds
 void resume()
          Resumes the timing, signaling the end of the pause
 void start()
          Signals the start of the timing
 void stop()
          Signals the end of the timing
 long timeInBreaks()
          Returns total amount of time spent in breaks (in millis)
 long totalTime()
          Returns the total amount of time spent in this timing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timing

public Timing(int id)
Builds an empty new timing
Method Detail

start

public void start()
Signals the start of the timing
Throws:
IllegalStateException - when start has been yet called.

stop

public void stop()
Signals the end of the timing
Throws:
IllegalStateException - when start has not been yet called or stop has been called before.

pause

public void pause(java.lang.String description)
Pauses the timing, signaling a break
Parameters:
description - The why of this break.
Throws:
IllegalStateException - when the timimng has not been started, has been stopped or is yet in pause mode.

resume

public void resume()
Resumes the timing, signaling the end of the pause
Throws:
IllegalStateException - when the timing has not been in pause

performance

public float performance()
Return the current calculated performance according to the current breaks.

performance is the relation among the project time and the real time, i.e.: project_rime/project_time <= 1
(Where project_time is the used time -without considering breaks).
To establish the impact over the performance, combine the value of the performance with the number of breaks.

Returns:
performance if timing has been started or zero if not.

projectTime

public long projectTime()
Returns the spent time for this timing (without breaks) in milliseconds

totalTime

public long totalTime()
Returns the total amount of time spent in this timing

getBreaksIterator

public java.util.Iterator getBreaksIterator()
Return an iterator over the list of breaks till the moment

timeInBreaks

public long timeInBreaks()
Returns total amount of time spent in breaks (in millis)

isStarted

public boolean isStarted()
Says if timing is started but not stopped yet

isStopped

public boolean isStopped()
Says if timing is stopped

isInPause

public boolean isInPause()
Says if timing is in pause (started, paused, but not stopped)


Luis F. Canals. Supported by www.sourceforge.net