|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.Channels
public class Channels
Channels is the API through which client programs set up two-way
communication channels with a JWalker.
The interaction pattern follows Java's event model. Client programs
must register a QuestionListener and a ReportListener with this API, to
handle QuestionEvents and ReportEvents, respectively. If no such
listeners are registered, then a default Console object is used, which
uses standard input and output for communication.
A QuestionListener is any object satisfying the QuestionListener interface,
which implements the respond(QuestionEvent) method. Typically, such a method
will display a question in the format desired by the client program and accept
a response from the user, returning this as an enumerated Answer value.
See the QuestionListener interface for more details.
A ReportListener is any object satisfying the ReportListener interface,
which implements the publish(ReportEvent) method. Typically, such a method
will display the contents of a report in the format desired by the client
program. See the ReportListener interface for more details.
QuestionEvent and ReportEvent are two kinds of event that respectively wrap
up a Question and a Report. Whenever a JWalker wishes to communicate, it
dispatches one or other of these events to the appropriate listener. The
listener will access the Question or Report using the API of QuestionEvent
or ReportEvent, respectively.
Constructor Summary | |
---|---|
Channels()
Creates the default Channels. |
Method Summary | |
---|---|
void |
addQuestionListener(QuestionListener listener)
Sets the handler for QuestionEvents to the new listener. |
void |
addReportListener(ReportListener listener)
Sets the handler for ReportEvents to the new listener. |
Answer |
dispatch(Question question)
Dispatches a Question from a JWalker via these Channels. |
void |
dispatch(Report report)
Dispatches a Report from a JWalker via these Channels. |
boolean |
interrupted()
Reports whether the current operating status is interrupted. |
boolean |
nominal()
Reports whether the current operating status is nominal. |
boolean |
outOfMemory()
Reports whether the JWalker engine ran out of memory during testing. |
void |
removeQuestionListener(QuestionListener listener)
Unregisters the handler for QuestionEvents. |
void |
removeReportListener(ReportListener listener)
Unregisters the handler for ReportEvents. |
void |
setNominal()
Resets the operating status to nominal. |
void |
setOutOfMemory()
Sets the operating status to Out of Memory. |
void |
setUserAborted()
Sets the operating status to User Aborted. |
boolean |
userAborted()
Reports whether the user aborted the current test cycle voluntarily. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Channels()
Method Detail |
---|
public void addQuestionListener(QuestionListener listener)
listener
- the QuestionListener to register.public void addReportListener(ReportListener listener)
listener
- the QuestionListener to register.public void removeQuestionListener(QuestionListener listener)
listener
- the QuestionListener to unregister.public void removeReportListener(ReportListener listener)
listener
- the ReportListener to unregister.public void dispatch(Report report)
report
- the Report being dispatched.public Answer dispatch(Question question)
question
- the Question being asked.
public boolean nominal()
public boolean interrupted()
public boolean outOfMemory()
public boolean userAborted()
public void setNominal()
public void setOutOfMemory()
public void setUserAborted()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |