12.06.2015 Views

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

The Annoyance Filter.pdf - Fourmilab

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

§24 ANNOYANCE-FILTER DICTIONARY 29<br />

}<br />

while (¬pq .empty ( )) {<br />

insert (make pair (pq .front ( ).get ( ), pq .front ( )));<br />

memoryRequired += pq .front ( ).estimateMemoryRequirement ( );<br />

pq .pop( );<br />

}<br />

#endif<br />

if (verbose ) {<br />

cerr ≪ size ( ) ≪ "␣words␣remaining." ≪ endl ;<br />

cerr ≪ "␣␣Dictionary␣size␣" ≪ estimateMemoryRequirement ( ) ≪ "␣bytes." ≪ endl ;<br />

}<br />

}<br />

25. <strong>The</strong> resetCat method resets the count for all words for the given mailCategory.<br />

〈 Class implementations 11 〉 +≡<br />

void dictionary ::resetCat (dictionaryWord ::mailCategory category )<br />

{<br />

if (verbose ) {<br />

cerr ≪ "Resetting␣counts␣for␣category␣" ≪ dictionaryWord ::categoryName (category ) ≪<br />

endl ;<br />

}<br />

for (iterator mp = begin ( ); mp ≠ end ( ); mp ++) {<br />

mp ⃗ second .resetCat (category );<br />

}<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!