/** The interface for the telephone directory.
 *  @author Koffman & Wolfgang
 */

public interface PhoneDirectory {

  /** Load the data file containing the directory, or
      establish a connection with the data source.
      @param sourceName The name of the file (data source)
                        with the phone directory entries
   */
  void loadData(String sourceName);

  
  /** Look up an entry.
      @param name The name of the person to look up
      @return An array of all numbers matching the given name,
              or null if the given name is not in the directory
   */
  String[] lookupEntry(String name);

  
  /** Add an entry or change an existing entry.
      @param name The name of the person being added or changed
      @param number The new number to be assigned
      @return True if the item was added, false if it was not (such as when 
              a duplicate entry already exists in the list).
   */
  boolean addEntry(String name, String number);


  /** Remove an entry from the directory.
      @param name  The name of the person to be removed
      @param number  The number of the person to be removed
      @return Whether the given name and number was found in the directory and
              removed.
   */
  boolean removeEntry(String name, String number);

  
  /** Method to save the directory.
      pre:  The directory has been loaded with data.
      post: Contents of directory written back to the file in the
            form of name-number pairs on adjacent lines,
            modified is reset to false.
   */
  void save();
}
