package dict; import java.lang.*; import schemeFactory.*; /* * 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. */ public boolean isEmpty(); /** * Returns an AList of DictionaryPairs corresponding to the entire * contents of the dictionary. */ public AList elements(); /** * 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); }