Tesuji Go Framework / MoveListener

Sub-page of TesujiGoFramework

MoveListener

Listener interfaces in Java are usually associated with the user-interface. That's not going to be any different here. But this interface will probably pop up in a few more places. That is simply because it's very natural in computer-Go for a component to listen to moves.

The methods stopMultiple() and startMultiple() are meant to be used so that a module that is producing moves (see MoveProducer below) can signal it's going to send a large number of events at once. This gives the listener the opportunity to wait with taking action until the producer signals it's completely done. Although useful at times I'm still considering throwing this out.

In accord to the accepted standard usage of listeners it has a MoveEvent class that is used as the event-message object to be sent to the listeners. Also here I'm starting to be inclined to replace this simply by Move or GoMove.

Move Producer

A class where one can register a MoveListener can be seen as a move-producer. As the mechanism to pass events to listeners is pretty standard I use a MoveProducer interface to tag classes where MoveListeners can listen for moves and a DefaultMoveProducer is used as a delegate to do the work of registering listeners and passing the events.


This is a copy of the living page "Tesuji Go Framework / MoveListener" at Sensei's Library.
(OC) 2009 the Authors, published under the OpenContent License V1.0.
[Welcome to Sensei's Library!]
StartingPoints
ReferenceSection
About