org.hackystat.telemetry.analyzer.reducer.impl
Class CoverageReducer

java.lang.Object
  extended by org.hackystat.telemetry.analyzer.reducer.impl.CoverageReducer
All Implemented Interfaces:
TelemetryReducer

public class CoverageReducer
extends java.lang.Object
implements TelemetryReducer

Returns a single stream providing Coverage data.

Options:

  1. mode: One of 'Percentage', 'NumCovered', or 'NumUncovered'. Default is 'Percentage'.
  2. granularity: A string indicating the type of coverage, such as 'line', 'method', 'class'. Default is 'method'.

Author:
Philip Johnson, Cedric Zhang

Nested Class Summary
static class CoverageReducer.Mode
          Possible mode values.
 
Constructor Summary
CoverageReducer()
           
 
Method Summary
 TelemetryStreamCollection compute(org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.utilities.time.interval.Interval interval, java.lang.String[] options)
          Computes and returns the required telemetry streams object.
(package private)  java.lang.Long getData(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.utilities.time.period.Day startDay, org.hackystat.utilities.time.period.Day endDay, CoverageReducer.Mode mode, java.lang.String granularity)
          Returns a Coverage value for the specified time interval, or null if no SensorData.
(package private)  TelemetryStream getStream(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient, org.hackystat.sensorbase.resource.projects.jaxb.Project project, org.hackystat.utilities.time.interval.Interval interval, CoverageReducer.Mode mode, java.lang.String granularity, java.lang.Object streamTagValue)
          Gets the telemetry stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CoverageReducer

public CoverageReducer()
Method Detail

compute

public TelemetryStreamCollection compute(org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                                         org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                                         org.hackystat.utilities.time.interval.Interval interval,
                                         java.lang.String[] options)
                                  throws TelemetryReducerException
Computes and returns the required telemetry streams object.

Specified by:
compute in interface TelemetryReducer
Parameters:
project - The project.
dpdClient - The DPD Client.
interval - The interval.
options - The optional parameters.
Returns:
Telemetry stream collection.
Throws:
TelemetryReducerException - If there is any error.

getStream

TelemetryStream getStream(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                          org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                          org.hackystat.utilities.time.interval.Interval interval,
                          CoverageReducer.Mode mode,
                          java.lang.String granularity,
                          java.lang.Object streamTagValue)
                    throws java.lang.Exception
Gets the telemetry stream.

Parameters:
dpdClient - The DailyProjectData client we will contact for the data.
project - The project.
interval - The interval.
mode - The mode (PERCENTAGE, NUMCOVERED, NUMUNCOVERED).
granularity - The type of coverage.
streamTagValue - The tag for the generated telemetry stream.
Returns:
The telemetry stream as required.
Throws:
java.lang.Exception - If there is any error.

getData

java.lang.Long getData(org.hackystat.dailyprojectdata.client.DailyProjectDataClient dpdClient,
                       org.hackystat.sensorbase.resource.projects.jaxb.Project project,
                       org.hackystat.utilities.time.period.Day startDay,
                       org.hackystat.utilities.time.period.Day endDay,
                       CoverageReducer.Mode mode,
                       java.lang.String granularity)
                 throws TelemetryReducerException
Returns a Coverage value for the specified time interval, or null if no SensorData. Note that we return a Long, so percentage is a Long ranging from 0 to 100. (There is no fractional coverage percentage.) We work backward through the time interval, and return the Coverage value for the first day in the interval for which Coverage data exists.

Parameters:
dpdClient - The DailyProjectData client we will use to get this data.
project - The project.
startDay - The start day (inclusive).
endDay - The end day (inclusive).
mode - The mode: PERCENTAGE, NUMCOVERED, or NUMUNCOVERED.
granularity - The type of coverage, such as 'line' or 'method'.
Returns:
The Coverage value, or null if there is no Coverage SensorData for that time period.
Throws:
TelemetryReducerException - If anything goes wrong.