void SummaryCommand :: DoFreq( IOManager & io ) { CalcFreqs(); for ( unsigned int i = 0; i < mRows.size(); i++ ) { string key = MakeKey( mRows.at(i) ); unsigned int n = mFreqMap.find( key )->second.mFreq; CSVRow r = mRows.at(i); r.insert( r.begin(), ALib::Str( n ) ); io.WriteRow( r ); } }
void SummaryCommand :: DoMode( IOManager & io ) { unsigned int mode = CalcFreqs(); for ( FreqMap::const_iterator it = mFreqMap.begin(); it != mFreqMap.end(); ++it ) { if ( it->second.mFreq == mode ) { for ( unsigned int i = 0; i < it->second.mIndex.size(); i++ ) { CSVRow r = mRows.at( it->second.mIndex.at(i) ); r.insert( r.begin(), ALib::Str( mode ) ); io.WriteRow( r ); } } } }