org.hackystat.dailyprojectdata.resource.devtime
Class DevTimeCounter

java.lang.Object
  extended by org.hackystat.dailyprojectdata.resource.devtime.DevTimeCounter

public class DevTimeCounter
extends java.lang.Object

Provides a facility for counting up the DevTime associated with a series of timestamps associated with DevEvent sensor data. The DevTimeCounter partitions a day into 288 five minute intervals. If at least one DevEvent timestamp occurs within an interval, that entire five minute interval counts as DevTime. At any time, the getDevTime() method can be called to find the total amount of DevTime accumulated so far. DevTime for a day can range from 0 minutes to 1440 minutes, in five minute increments. Note that the DevTimeCounter looks only at the hours, minutes, and seconds associated with a timestamp. The client is responsible for assuring that all of the timestamps are associated with the same day.

Author:
Philip Johnson

Constructor Summary
DevTimeCounter()
          Create a new DevTimeCounter, initialized to zero DevTime.
 
Method Summary
 void addDevEvent(javax.xml.datatype.XMLGregorianCalendar timestamp)
          Update the DevTimeCounter with a new DevEvent.
 java.math.BigInteger getDevTime()
          Returns the total DevTime (in minutes, as a multiple of five) associated with this DevTimeCounter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DevTimeCounter

public DevTimeCounter()
Create a new DevTimeCounter, initialized to zero DevTime.

Method Detail

addDevEvent

public void addDevEvent(javax.xml.datatype.XMLGregorianCalendar timestamp)
Update the DevTimeCounter with a new DevEvent. Its five minute interval will now count as DevTime (if it didn't already).

Parameters:
timestamp - The timestamp to add.

getDevTime

public java.math.BigInteger getDevTime()
Returns the total DevTime (in minutes, as a multiple of five) associated with this DevTimeCounter. Returns a BigInteger because that's what the XML wants.

Returns:
The total DevTime, from 0 to 1440 (5 * 288).