/**
 * WordIndex.java
 *
 * Created 11/28/06
 * Last modified 11/28/06
 */

package lab14;

import java.util.*;


/**
 * This subclass of labtrees.BinaryTree stores
 * a single {@link IndexItem} in each tree node. It features
 * an insert() method that accepts a new {@link IndexItem}
 * containing a word found in a textfile scan, as well as
 * the line number where the word was found.
 *
 * @author J.K. Daugherty
 */
public class WordIndex {

    private TreeSet<IndexItem> tree;

    public WordIndex () {
        tree = new TreeSet<IndexItem>();
    }

    /** This method is invoked by the
     * {@link DisplayFrame#buildIndex} method of the main
     * {@link DisplayFrame} application for each word it finds while
     * scanning a textfile. The application sends this method()
     * a new {@link IndexItem} containing the word
     * and the number of the line where this occurrence of the word
     * was found in the text. If this is the first occurrence
     * of this word, a new leaf node is created to store this new
     * {@link IndexItem} as its data. However, if the word has already
     * been found in the text, the item containing that word is updated
     * in two ways. First, the occurrence count for the word must be
     * incremented. Second, the line number must be extracted from
     * the "new" {@link IndexItem} parameter and then added to the queue
     * of line numbers in the existing {@link IndexItem}.
     * <P>
     * @param item The {@link IndexItem} containing the word and its
     * associated line number.
     */

    public void insert (IndexItem item) { 
        // STUB -- FILL IN
    }

    public int getItemCount () {
        // STUB -- FILL IN
	// return 0;    // Just allows initial compilation...replace this...        
    }

    public void removeAll () {
        // STUB -- FILL IN
    }
    
    public Iterator<IndexItem> listAscending () {
        // STUB -- FILL IN
	// return null;    // Just allows initial compilation...replace this...
    }
}
