org.jwalk.out
Class Question

java.lang.Object
  extended by org.jwalk.out.Report
      extended by org.jwalk.out.Question
Direct Known Subclasses:
Confirmation, Notification

public abstract class Question
extends Report

Question is the abstract ancestor of all kinds of question. A Question is a kind of Report, which has textual content, but also has a query prompt, which can be presented independently of the content. This allows GUIs to present the information content of a Question just the once, but gives the freedom to repeat the query prompt multiple times, until the human tester gives a satisfactory reply. Whereas a Report only expects to be published, a Question expects some kind of response or acknowledgement from the tester.

Question is abstract and has the descendants: Confirmation, representing a request to confirm a test outcome; and Notification, representing a result, which requires explicit acknowledgement from the tester.

Version:
1.0
Author:
Anthony Simons

Field Summary
 
Fields inherited from class org.jwalk.out.Report
edition, walker
 
Constructor Summary
protected Question(Edition edition, JWalker walker)
          Secretly initialises the edition and the walker.
 
Method Summary
abstract  java.lang.String getQuestion()
          Returns the query-prompt of this Question as formatted text.
 java.lang.String toString()
          Returns this Question as formatted text.
 
Methods inherited from class org.jwalk.out.Report
getContent, getEdition, getJWalker
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Question

protected Question(Edition edition,
                   JWalker walker)
Secretly initialises the edition and the walker. Used by descendants to initialise a particular kind of Question.

Parameters:
edition - indicates the kind of Question.
walker - the JWalker asking this Question.
Method Detail

toString

public java.lang.String toString()
Returns this Question as formatted text. This is one approach to presenting the whole of this Question to the user. By default, this returns the result of appending getContent() and getQuestion(). A more sophisticated approach will present getContent() just once and then present getQuestion() possibly many times, in a loop that seeks to elicit a valid response.

Overrides:
toString in class Report
Returns:
this Question as formatted text.

getQuestion

public abstract java.lang.String getQuestion()
Returns the query-prompt of this Question as formatted text. This is provided so that GUIs can choose to repeat the query-prompt of a Question if an invalid response was received from the tester. It decouples the query-prompt from the main content about which the judgement is being made.

Returns:
the query-prompt of the Question.