package chapter01;

/** The interface for the telephone directory.
 *  @author Koffman & Wolfgang
 */

public interface PhoneDirectorynew {

  /** Method to add new data from a different file.
   * No duplication check.
   * The new file name becomes the source name
   */
  void addFromFile(String sourceName);
	  
  /** 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 PersonInt to look up
      @return The number or null if name is not in the directory
   */
  String lookupEntry(String name);

  /** Add an entry or change an existing entry.
      @param name The name of the PersonInt being added or changed
      @param number The new number to be assigned
      @return The old number or, if a new entry, null
   */
  String addOrChangeEntry(String name, String number);

  /** Remove an entry from the directory.
      @param name The name of the PersonInt to be removed
      @return The current number. If not in directory, null is
              returned
   */
  String removeEntry(String name);

  /** 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();
}
