org.hackystat.dailyprojectdata.resource.filemetric
Class FileMetricCounter

java.lang.Object
  extended by org.hackystat.dailyprojectdata.resource.filemetric.FileMetricCounter

public class FileMetricCounter
extends java.lang.Object

Provides a facility for counting the FileMetrics associated with a SensorData. It only counts the FileMetrics from the 'last' run of the same tool. This ensures that the FileMetric size is the latest snapshot of the Project's size. The FileMetricCounter currently only looks at TotalLines.

Author:
Cam Moore

Constructor Summary
FileMetricCounter(org.hackystat.sensorbase.client.SensorBaseClient client)
          Constructs a FileMetricCounter.
 
Method Summary
 void add(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef ref)
          Adds the SensorData to the list of FileMetrics if it is in the last run of the size counting tool.
 java.util.List<org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData> getFileMetrics()
           
 javax.xml.datatype.XMLGregorianCalendar getLastTime()
           
 java.math.BigInteger getTotalLines()
           
 java.math.BigInteger getTotalLines(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData data)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileMetricCounter

public FileMetricCounter(org.hackystat.sensorbase.client.SensorBaseClient client)
Constructs a FileMetricCounter.

Parameters:
client - the SensorBaseClient to use to get the SensorData.
Method Detail

add

public void add(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorDataRef ref)
Adds the SensorData to the list of FileMetrics if it is in the last run of the size counting tool. Updates the total lines value. If this sensor data represents a new run of a size counting tool then the total lines and list of file metrics is reset.

Parameters:
ref - a SensorDataRef, the sensor data to add.

getTotalLines

public java.math.BigInteger getTotalLines()
Returns:
The total lines as a BigInteger.

getFileMetrics

public java.util.List<org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData> getFileMetrics()
Returns:
The individual FileMetrics SensorDataRefs.

getLastTime

public javax.xml.datatype.XMLGregorianCalendar getLastTime()
Returns:
The last time a size counting tool was run.

getTotalLines

public java.math.BigInteger getTotalLines(org.hackystat.sensorbase.resource.sensordata.jaxb.SensorData data)
Parameters:
data - a SensorData.
Returns:
The total lines in the given SensorData or 0 if the property "TotalLines" is undefined.