#include "LineStat.h"
#include "BlankStat.h"


LineStat::LineStat() {
  list.reserve( 10 );
}


LineStat::~LineStat() {
}


void LineStat::beginJob() {
  // create 3 mean calculator, for 3 length ranges
  // if any range does change, the change is to be applied only here
  list.push_back( new BlankStat(  1, 20 ) );
  list.push_back( new BlankStat( 21, 40 ) );
  list.push_back( new BlankStat( 41, 80 ) );
  return;
}


void LineStat::process( const std::string& line ) {
  // pass the input line to all mean calculators, 
  // each calculator takes care of processing the input or ignoring it
  // according to line length
  int i;
  int n = list.size();
  for ( i = 0; i < n; ++i ) list[i]->process( line );
  return;
}


void LineStat::endJob() {
  // print results for all mean calculators
  int i;
  int n = list.size();
  for ( i = 0; i < n; ++i ) list[i]->print();
  return;
}

