Exemple #1
0
        /*
         * Populates form with filepaths, most common word,
         * query term frequency and files found.
         * Fires resets for collectionFreq and output,
         * so they are new objects for next search.
         * @param Boolean useDatabase.
         */
        private void fileToForm(Boolean useDatabase)
        {
            if (fileUtil.getOutput.Count == 0)//handles no files being found.
            {
                FilePathOutput.Items.Add("No files found");
            }

            foreach (string s in fileUtil.getOutput)                    //iterates through output, using it's getter.
            {
                FilePathOutput.Items.Add(s);                            //adds each string to list box.
            }
            Found.Text         = (fileUtil.getOutput.Count).ToString(); //sets Found.Text to length of output, using it's getter.
            commonWord.Text    = TermFreq.CollectionFreq();             //sets commonWord.Text to return variable from CollectionFreq()
            QueryTermFreq.Text = TermFreq.QueryTermFreq(searchTerms);   //sets QueryTermFreq to variable returned from QueryTermFreq()
            fileUtil.ResetOutput();                                     //sets ArrayList output to new ArrayList.
            TermFreq.ResetFreq();                                       //sets Hashtable collectionWordsFreq to new HashTable.
        }
Exemple #2
0
        /*
         * Populates form with filepaths, most common word,
         * query term frequency and files found.
         * Fires resets for collectionFreq and output,
         * so they are new objects for next search.
         * @param Boolean useDatabase.
         */
        private void FileToForm()
        {
            Dictionary <string, int> output = index.WriteToOutput();

            if (output.Count == 0)//handles no files being found.
            {
                FilePathOutput.Items.Add("No files found");
            }

            foreach (string s in output.Keys)                         //iterates through output, using it's getter.
            {
                FilePathOutput.Items.Add(s);                          //adds each string to list box.
            }
            Found.Text         = (output.Count).ToString();           //sets Found.Text to length of output, using it's getter.
            commonWord.Text    = TermFreq.CollectionFreq();           //sets commonWord.Text to return variable from CollectionFreq()
            QueryTermFreq.Text = TermFreq.QueryTermFreq(searchTerms); //sets QueryTermFreq to variable returned from QueryTermFreq()
            ICollection key = InvertedIndex.invertedIndex.Keys;       //remove before submission, for debugging.
        }