BaseCount Class Reference

This class is a wrapper around an array that has one index per base and an extra index for a total count of all bases. More...

#include <BaseCount.h>

List of all members.

Public Member Functions

 BaseCount ()
 Constructor, initializes the array to be all 0s.
bool incrementCount (int baseIndex)
 Update the count for the specified index as well as the overall count (The last index).
void printPercent ()

Detailed Description

This class is a wrapper around an array that has one index per base and an extra index for a total count of all bases.

This class is used to keep a count of the number of times each index has occurred. It can print a percentage of the occurrence of each base against the total number of bases.

Definition at line 27 of file BaseCount.h.


Member Function Documentation

bool BaseCount::incrementCount ( int  baseIndex  ) 

Update the count for the specified index as well as the overall count (The last index).

Returns:
false if the specified index is < 0 or >= myBaseSize-1, otherwise returns true. The reason it returns false if it is equal to the size-1 is because the last index is used to track an overall count.

Definition at line 38 of file BaseCount.cpp.

00039 {
00040    // Check to see if the index is within range (>=0 & < myBaseSize-1)
00041    // The last entry of the array is invalid since it is used to track
00042    // total occurrence of all other entries.
00043    if((baseIndex < myBaseSize-1) && (baseIndex >= 0))
00044    {
00045       // Valid index, so increment that index as well as the overall
00046       // count (index myBaseSize-1) and return true.
00047       myBaseCount[baseIndex]++;
00048       myBaseCount[myBaseSize-1]++;
00049       return true;
00050    }
00051    else
00052    {
00053       // Invalid index, return false
00054       return false;
00055    }
00056 }


The documentation for this class was generated from the following files:
Generated on Mon Feb 11 13:45:21 2013 for libStatGen Software by  doxygen 1.6.3