Interface ur_Robot.ConnectStrategy

Enclosing class:

public static interface ur_Robot.ConnectStrategy

Used so that tailored communication strategies may be developed. If you pass a null strategy object, then a default strategy will be employed in which the BufferedReader object is added to a list of senders that are polled in the waitForNextCommunication method. If you employ your own strategy, this won't happen, nor will waitForNextCommunication listen to this sender unless you arrange for it in your strategy object. You can employ your own listening strategy but will need to implement it. The typical action method looks something like the following

public void action(ur_Robot sender, ur_Robot receiver, BufferMan manager)
{	if(sender...)
		receiver.whatever(sender, manager);

This interface is used only in Chapter 11 of the book. See the Strategy Design Pattern in "Design Patterns" by Gamma, Helm, Johnson, and Vlissides (Addison-Wesley) for more on strategies and how they are used.

Method Summary
 void action(ur_Robot sender, ur_Robot receiver, java.io.BufferedReader manager)

Method Detail


public void action(ur_Robot sender,
                   ur_Robot receiver,
                   java.io.BufferedReader manager)

See Chapter 11. This is executed as part of the connection process in establishing a communication link between two robots. The default strategy will have the receiver remember the manager and will listen for communication from the sender over this link. The receiver can remember many such managers.

In the future this may be generalized to pass an arbitrary object instead of a Reader.