//****************** // concordance class // // Implements the concordance class // Provides the user interface for // the concordance, hiding the underlying BST // // DL Frey 10/21/98 // // each concordance class function just // calls the appropriate concordance tree // function -- this may be a new concordance // tree function, or one inherited from BST //************************* #include "concordance.h" //****************************************** // Insert (const char*) // // insert a character string into concordance // by converting it to concordance data class // (CData) and inserting in the concordance tree // with count = 1 //******************************************* void Concordance::Insert (const char *s) { tree.Insert (CData(s)); } //************************** // PrintWords (int frequency) // // prints all words with counts for words // whose counts are >= frequency in alpahbetical // order // // use PrintWords (0) for the entire tree //*************************************** void Concordance::PrintWords (int freq) { tree.PrintNodes (freq); } //************************************** // PrintAWord (const char *s) // // finds and prints the number of occurrences // of a particular char string // // convert s to CData and find it in the tree //************************************* void Concordance::PrintAWord (const char *s) { tree.PrintANode (CData(s)); } //******************************** // CountWords () // // CountWords in the concordance by // counting nodes in the tree. // NOTE that Count_Nodes is part of // the base BST class //******************************** int Concordance::CountWords () { return tree.Count_Nodes(); }