de.upb.swtpra05.group03.shuttle
Class StrategyControl

java.lang.Object
  extended byde.upb.swtpra05.group03.shuttle.StrategyControl
All Implemented Interfaces:
Module, ShuttleModule, StrategyControlInterface

public class StrategyControl
extends java.lang.Object
implements ShuttleModule, StrategyControlInterface

Controls the strategy by providing the information which shuttle is the master shuttle.

Version:
$Revision: 1.3 $

Field Summary
protected  ShuttleControlInterface agent
          The shuttle control
protected  CompanyInterface company
          The company
private static java.util.logging.Logger log
          Logger for debugging
protected  de.upb.swtpra.kernel.id.ID masterID
          id of the current master shuttle
protected  PluginMessengerInterface plugin
          The plugin
 
Fields inherited from interface de.upb.swtpra05.group03.shuttle.StrategyControlInterface
MASTER_STRATEGY
 
Constructor Summary
StrategyControl()
          Constructor
 
Method Summary
 de.upb.swtpra.kernel.id.ID getMasterShuttleID()
          Returns the master shuttle id.
 int getStrategy()
          Returns the current strategy.
 void init(ModuleContainerInterface manager)
          Initializes this module.
 boolean isMasterShuttle()
          Returns if this shuttle is the master shuttle.
 void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
          React on the received message of the shuttle or not.
protected  void updateMasterShuttleID()
          updates masterID to hold the lowest id of all shuttles
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static final java.util.logging.Logger log
Logger for debugging


agent

protected ShuttleControlInterface agent
The shuttle control


company

protected CompanyInterface company
The company


plugin

protected PluginMessengerInterface plugin
The plugin


masterID

protected de.upb.swtpra.kernel.id.ID masterID
id of the current master shuttle

Constructor Detail

StrategyControl

public StrategyControl()
Constructor

Method Detail

init

public void init(ModuleContainerInterface manager)
Description copied from interface: Module
Initializes this module. References to other modules should be set here to avoid circle dependencies.

Specified by:
init in interface Module
Parameters:
manager - The module manager which contain all modules

newMessageReceived

public void newMessageReceived(de.upb.swtpra.kernel.message.Message msg)
Description copied from interface: ShuttleModule
React on the received message of the shuttle or not.

Specified by:
newMessageReceived in interface ShuttleModule
Parameters:
msg - The received message of the shuttle

updateMasterShuttleID

protected void updateMasterShuttleID()
updates masterID to hold the lowest id of all shuttles


getStrategy

public int getStrategy()
Description copied from interface: StrategyControlInterface
Returns the current strategy.

Specified by:
getStrategy in interface StrategyControlInterface
Returns:
the current strategy

getMasterShuttleID

public de.upb.swtpra.kernel.id.ID getMasterShuttleID()
Description copied from interface: StrategyControlInterface
Returns the master shuttle id.

Specified by:
getMasterShuttleID in interface StrategyControlInterface
Returns:
the master shuttle id

isMasterShuttle

public boolean isMasterShuttle()
Description copied from interface: StrategyControlInterface
Returns if this shuttle is the master shuttle.

Specified by:
isMasterShuttle in interface StrategyControlInterface
Returns:
if this shuttle is the master shuttle.