IDictionary.java
package dict;

import java.lang.*;
import listFW.*;

/*
 * Defines an interface for a simple dictionary.
 */
public interface IDictionary {
    /**
     * Clears the contents of the dictionary leaving it empty.
     */
    public void clear();

    /**
     * Returns true if the dictionary is empty and false otherwise.
     * Non OO!
     * How can we eliminate this check?
     */
    public boolean isEmpty();

    /**
     * Returns true if the dictionary is full and false otherwise.
     */
    public boolean isFull();

    /**
     * Returns an IList of DictionaryPairs corresponding to the entire
     * contents of the dictionary.
     * @param lf a factory to manufacture IList objects.
     */
    public IList elements(IListFactory lf);

    /**
     * Returns the DictionaryPair with the given key.  If there is not
     * a DictionaryPair with the given key, returns null. 
     *
     * Returns a DictionaryPair rather than the value alone so that
     * the user can distinguish between not finding the key and
     * finding the pair (key, null). 
     */
    public DictionaryPair lookup(Comparable key);

    /**
     * Inserts the given key and value.  If the given key is already
     * in the dictionary, the given value replaces the key's old
     * value. 
     */
    public void insert(Comparable key, Object value);

    /**
     * Removes the DictionaryPair with the given key and returns it.
     * If there is not a DictionaryPair with the given key, returns
     * null.
     */
    public DictionaryPair remove(Comparable key);
}