com.tomgibara.pronto.control.impl
Class ControllerImpl<S,L,P>

java.lang.Object
  extended by com.tomgibara.pronto.control.impl.ControllerImpl<S,L,P>
Type Parameters:
S - the type of state
L - the type of label
P - the type of parameter
All Implemented Interfaces:
Controller<S,L,P>

public class ControllerImpl<S,L,P>
extends java.lang.Object
implements Controller<S,L,P>

The standard implementation of the Controller interface. It aggregates a number of ControllerParts that provide its actual functionality. This means that a single instance of this class can actually provide 'multiple' functionality based on the a settings object that implements a number of different ControllerSettings interfaces.

Author:
Tom Gibara

Constructor Summary
ControllerImpl(com.tomgibara.pronto.state.StateEngine<S,L,P> engine, EngineControlAdapter<S,L,P> adapter)
           
 
Method Summary
 EngineControlAdapter<S,L,P> getAdapter()
          The adapter that is being used by the controller to mediate external events and the state graph.
 com.tomgibara.pronto.state.StateEngine<S,L,P> getEngine()
          The engine through which this controller operates.
 void start()
          Starts the controller.
 boolean stop(long timeout)
          Stops the controller.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ControllerImpl

public ControllerImpl(com.tomgibara.pronto.state.StateEngine<S,L,P> engine,
                      EngineControlAdapter<S,L,P> adapter)
Method Detail

getAdapter

public EngineControlAdapter<S,L,P> getAdapter()
Description copied from interface: Controller
The adapter that is being used by the controller to mediate external events and the state graph.

Specified by:
getAdapter in interface Controller<S,L,P>
Returns:
the adapter used by this controller

getEngine

public com.tomgibara.pronto.state.StateEngine<S,L,P> getEngine()
Description copied from interface: Controller
The engine through which this controller operates.

Specified by:
getEngine in interface Controller<S,L,P>
Returns:
the engine used by this controller

start

public void start()
Description copied from interface: Controller
Starts the controller. If the controller has already been started, no action is taken.

Specified by:
start in interface Controller<S,L,P>

stop

public boolean stop(long timeout)
Description copied from interface: Controller
Stops the controller. If the controller has already been stopped, or has not yet been started, the method returns immediately with the value true.

Specified by:
stop in interface Controller<S,L,P>
Parameters:
timeout - the number of milliseconds that the calling thread is willing to wait for stoppage to occur, 0L waits indefinitely.
Returns:
true if the controller is not running, false otherwise.


Copyright © 2006-2007 Tom Gibara. All Rights Reserved.