Class ConsoleDialog

  • All Implemented Interfaces:
    Dialog

    public class ConsoleDialog
    extends java.lang.Object
    implements Dialog
    A simple utility class to handle command line dialogs
    Author:
    Nathan Green, Keith Visco
    • Constructor Summary

      Constructors 
      Constructor Description
      ConsoleDialog()
      Creates a new Console Dialog
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean confirm​(java.lang.String message)
      Presents a confirmation prompt with the given message.
      char confirm​(java.lang.String message, java.lang.String values)
      Presents a confirmation prompt for values with the given messge.
      char confirm​(java.lang.String message, java.lang.String values, java.lang.String help)
      Presents a confirmation prompt for values with the given messge
      void notify​(java.lang.String message)
      Displays the given message to the user.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ConsoleDialog

        public ConsoleDialog()
        Creates a new Console Dialog
    • Method Detail

      • confirm

        public boolean confirm​(java.lang.String message)
        Presents a confirmation prompt with the given message.
        Specified by:
        confirm in interface Dialog
        Parameters:
        message - the confirmation prompt message to display
        Returns:
        true if the user has selected a positive confirmation, otherwise false
      • confirm

        public char confirm​(java.lang.String message,
                            java.lang.String values)
        Presents a confirmation prompt for values with the given messge.
        Specified by:
        confirm in interface Dialog
        Parameters:
        message - the confirmation prompt to display
        values - a list of valid characters to accept
        Returns:
        whatever character the user presses
      • confirm

        public char confirm​(java.lang.String message,
                            java.lang.String values,
                            java.lang.String help)
        Presents a confirmation prompt for values with the given messge
        Specified by:
        confirm in interface Dialog
        Parameters:
        message - the confirmation prompt to display
        values - a list of valid characters to accept
        help - a help message when the user presses '?'
        Returns:
        whatever character the user presses
      • notify

        public void notify​(java.lang.String message)
        Displays the given message to the user. No input is returned from the user.
        Specified by:
        notify in interface Dialog
        Parameters:
        message - the message to display to the user