
/**
 * An alphabetized list of words and associated frequencies of occurrence in
 * a text
 * 
 * @author Russell C. Bjork 
 * @version March 22, 2008
 */

public interface WordFrequencyList
{
    /** Record the occurrence of a word in the text
     * 
     *  @param word the word that occurred in the text
     *  @return a modified list in which either the word is added at the
     *          appropriate place with frequency of 1 (if it had not occurred
     *          before), or the frequency of an existing word is increased by
     *          one.
     */
    WordFrequencyList recordOccurrence(String word);
    
    /** Report the total length of this list
     * 
     *  @return the length of this list
     */
    int length();
    
    /** Report the total frequencies for all words in this list
     * 
     *  @return the total frequencies for all words in this list
     */
    int totalFrequencies();
    
    /** Report the number of occurrences of a particular word
     * 
     *  @param word the word 
     *  @return the number of times this word has occurred
     */
    int occurrencesFor(String word);
    
    /** Print all words in this list with their associated frequencies
     */
    void print();
}
