#include "BlankStat.h"

#include <iostream>
using namespace std;

BlankStat::BlankStat( int lMin, int lMax ):
  minLength( lMin ),
  maxLength( lMax ),
  nLines( 0 ),
  nBlanks( 0 ) {
}


BlankStat::~BlankStat() {
}


void BlankStat::process( const std::string& line ) {
  const char* s = line.c_str();
  char c;
  while (( c = *s++ )) {
    if ( c == ' ' ) ++nBlanks;
  }
  ++nLines;
  return;
}


void BlankStat::print() {
  cout << "length: "
       << minLength << " - " << maxLength << " : "
       << nLines << " lines ; "
       << nBlanks * 1.0 / nLines << " blanks" << endl;
  return;
}

