/** * Very simple dictionaries that map keys to values. * * @author Samuel A. Rebelsky * @version 1.2 of April 2000 */ public interface Dictionary { /** * Add an entry to the dictionary. * Pre: The key and value are non-null. * Pre: The key can be compared to other values in the dictionary. * Post: Subsequent calls to get(key) will return value. * * @exception Exception * If the key cannot be compared. */ public void add(Object key, Object value) throws Exception; /** * Determine if a particular key is in the dictionary. * Pre: None. * Post: Returns true if the key is in the dictionary; * Returns false otherwise. */ public boolean contains(Object key); /** * Delete an entry in the dictionary. * Pre: The key is non-null. * Pre: The key can be compared to other values in the dictionary. * Post: Deletes the entry. * Note: Added in version 1.2. * @exception Exception * If the key cannot be compared or there is no such entry. */ public void delete(Object key) throws Exception; /** * Look up an entry in the dictionary. * Pre: The key is non-null. * Pre: The key can be compared to other values in the dictionary. * Post: Returns the value most recently "put" with the key. * * @exception Exception * If the key cannot be compared or there is no such entry. */ public Object lookup(Object key) throws Exception; } // interface Dictionary