Class Display

java.lang.Object
ubc.team09.view.Display

public class Display extends Object
A class with static methods to display information and prompt users for input via the CLI.
  • Method Details

    • promptString

      public static String promptString(String prompt)
      Prompts the user for a string input.
    • promptInt

      public static int promptInt(String prompt)
      Prompts the user for an integer input.
    • prompt

      public static String prompt(String prompt, Map<String,String> options)
      Prompts the user for a string, but only allows values specified by options. E.g.,
      // The key of the map is an allowed option, and the value is a short
      // description. The description should be less than ~50 characters.
      Map<String, String> options = new HashMap<>();
      options.put("Agedashi Tofu", "Fried tofu in tempura sauce");
      options.put("Green Salad", "");
      options.put("Yakitori", "2 chicken skewers");
      
      String chosenItem = Display.prompt(
      	"Choose an item from the menu.",
      	options
      );
      
      // `chosenItem` will be one of the keys from the `options` map.
      
    • prompt

      public static String prompt(String prompt, List<String> options)
      Prompts the user for an input string, but only accepts values specified by options.
    • printText

      public static void printText(int line, String text)
    • printBlinkingText

      public static void printBlinkingText(int line, String text)
    • printSystemMessages

      public static void printSystemMessages(LinkedList<String> messages)
    • printGameBoard

      public static void printGameBoard(BoardState state, int lastMove, String label, String blackName, String whiteName, LinkedList<String> messages)
      Prints a board state to the console.
      Parameters:
      state -
      label -
      blackName -
      whiteName -
    • printBoard

      public static void printBoard(State state, String label, String blackName, String whiteName)
      Prints a board state to the console.
    • printBoard

      public static void printBoard(State state, String label)
      Prints a board state to the console.
    • clear

      public static void clear()