Interface UserInterface


public interface UserInterface

Interface describing abstract user interaction operations. This interface is implemented by the graphical and text UIs for the game. Your QuestionTree interacts with the UI through this interface.


Method Summary
 boolean nextBoolean()
          Waits for the user to input a yes/no answer (by typing, clicking, etc.), and returns that answer as a boolean value.
 java.lang.String nextLine()
          Waits for the user to input a text value, and returns that answer as a String.
 void print(java.lang.String message)
          Displays the given output message to the user.
 void println(java.lang.String message)
          Displays the given output message to the user.
 

Method Detail

nextBoolean

boolean nextBoolean()
Waits for the user to input a yes/no answer (by typing, clicking, etc.), and returns that answer as a boolean value.

Returns:
the answer typed by the user as a boolean (yes is true, no is false)

nextLine

java.lang.String nextLine()
Waits for the user to input a text value, and returns that answer as a String.

Returns:
the answer typed by the user as a String (empty string if no answer typed)

print

void print(java.lang.String message)
Displays the given output message to the user.

Parameters:
message - The message to display. Assumes not null.

println

void println(java.lang.String message)
Displays the given output message to the user. If the UI is a text UI, also inserts a line break (\n).

Parameters:
message - The message to display. Assumes not null.