edu.memphis.ccrg.lida.globalworkspace
Class GlobalWorkspaceImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
      extended by edu.memphis.ccrg.lida.globalworkspace.GlobalWorkspaceImpl
All Implemented Interfaces:
FrameworkModule, FullyInitializable, Initializable, RefractoryPeriod, GlobalWorkspace, TriggerListener

public class GlobalWorkspaceImpl
extends FrameworkModuleImpl
implements GlobalWorkspace

This class implements GlobalWorkspace and maintains the collection of Coalitions. It supports BroadcastTriggers that are in charge of triggering the new broadcast. Triggers should implement BroadcastTrigger interface. This class maintains a list of BroadcastListeners. These are the modules that need to receive broadcast content.

Author:
Javier Snaider, Ryan J. McCall

Field Summary
 
Fields inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
taskSpawner
 
Constructor Summary
GlobalWorkspaceImpl()
          Constructor a new instance with default values
 
Method Summary
 void addBroadcastListener(BroadcastListener bl)
          To register a BroadcastListener.
 void addBroadcastTrigger(BroadcastTrigger t)
          To register Triggers
 boolean addCoalition(Coalition coalition)
          This method is invoked by the AttentionCodelet to add a new Coalition
 void addListener(ModuleListener listener)
          Override this method to add a listener to the module
 void decayModule(long ticks)
          Decay only this Module.
 long getBroadcastSentCount()
          Returns broadcastSentCount
 DecayStrategy getCoalitionDecayStrategy()
          Gets coalitionDecayStrategy
 double getCoalitionRemovalThreshold()
          Gets coalition removal threshold
 java.lang.Object getModuleContent(java.lang.Object... params)
          Intended to be called from the GUI.
 int getRefractoryPeriod()
          Gets refractoryPeriod
 long getTickAtLastBroadcast()
          Gets the tick at last broadcast
 void init()
          Will set the parameters with the following names:

globalWorkspace.coalitionRemovalThreshold
globalWorkspace.coalitionDecayStrategy
globalWorkspace.refractoryPeriod
 void setCoalitionDecayStrategy(DecayStrategy coalitionDecayStrategy)
          Sets coalitionDecayStrategy
 void setCoalitionRemovalThreshold(double coalitionRemovalThreshold)
          Sets coalition removal threshold
 void setRefractoryPeriod(int period)
          Sets refractoryPeriod
 void triggerBroadcast(BroadcastTrigger trigger)
          Listener must be able to trigger a broadcast
 
Methods inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
addSubModule, containsSubmodule, containsSubmodule, getAssistingTaskSpawner, getModuleName, getParam, getSubmodule, getSubmodule, getSubmodules, init, setAssistingTaskSpawner, setAssociatedModule, setModuleName, taskManagerDecayModule, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.FrameworkModule
addSubModule, containsSubmodule, containsSubmodule, getAssistingTaskSpawner, getModuleName, getSubmodule, getSubmodule, getSubmodules, setAssistingTaskSpawner, setModuleName, taskManagerDecayModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.FullyInitializable
setAssociatedModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
getParam, init
 

Constructor Detail

GlobalWorkspaceImpl

public GlobalWorkspaceImpl()
Constructor a new instance with default values

Method Detail

init

public void init()
Will set the parameters with the following names:

globalWorkspace.coalitionRemovalThreshold
globalWorkspace.coalitionDecayStrategy
globalWorkspace.refractoryPeriod

Specified by:
init in interface Initializable
Overrides:
init in class FrameworkModuleImpl
See Also:
FrameworkModuleImpl.init()

addListener

public void addListener(ModuleListener listener)
Description copied from class: FrameworkModuleImpl
Override this method to add a listener to the module

Specified by:
addListener in interface FrameworkModule
Overrides:
addListener in class FrameworkModuleImpl
Parameters:
listener - - listener of this FrameworkModule

addBroadcastListener

public void addBroadcastListener(BroadcastListener bl)
Description copied from interface: GlobalWorkspace
To register a BroadcastListener. Each registered BroadcastListener receives Broadcast Implements Observer Pattern

Specified by:
addBroadcastListener in interface GlobalWorkspace
Parameters:
bl - the BroadcastListener to register

addBroadcastTrigger

public void addBroadcastTrigger(BroadcastTrigger t)
Description copied from interface: GlobalWorkspace
To register Triggers

Specified by:
addBroadcastTrigger in interface GlobalWorkspace
Parameters:
t - a new Trigger

addCoalition

public boolean addCoalition(Coalition coalition)
Description copied from interface: GlobalWorkspace
This method is invoked by the AttentionCodelet to add a new Coalition

Specified by:
addCoalition in interface GlobalWorkspace
Parameters:
coalition - to be added
Returns:
true if coalition was added

triggerBroadcast

public void triggerBroadcast(BroadcastTrigger trigger)
Description copied from interface: TriggerListener
Listener must be able to trigger a broadcast

Specified by:
triggerBroadcast in interface TriggerListener
Parameters:
trigger - that wants to start the broadcast

getModuleContent

public java.lang.Object getModuleContent(java.lang.Object... params)
Description copied from class: FrameworkModuleImpl
Intended to be called from the GUI. Override this method to return particular module content based on params.

Specified by:
getModuleContent in interface FrameworkModule
Overrides:
getModuleContent in class FrameworkModuleImpl
Parameters:
params - - specifies what content will be returned.
Returns:
various kinds of content of this module.

decayModule

public void decayModule(long ticks)
Description copied from interface: FrameworkModule
Decay only this Module.

Specified by:
decayModule in interface FrameworkModule
Parameters:
ticks - number of ticks to decay.

getBroadcastSentCount

public long getBroadcastSentCount()
Description copied from interface: GlobalWorkspace
Returns broadcastSentCount

Specified by:
getBroadcastSentCount in interface GlobalWorkspace
Returns:
a count of the current number of broadcasts sent

getRefractoryPeriod

public int getRefractoryPeriod()
Gets refractoryPeriod

Specified by:
getRefractoryPeriod in interface RefractoryPeriod
Returns:
number of ticks that must pass after a broadcast has been sent before a new one can be sent.
See Also:
TaskManager

getTickAtLastBroadcast

public long getTickAtLastBroadcast()
Description copied from interface: GlobalWorkspace
Gets the tick at last broadcast

Specified by:
getTickAtLastBroadcast in interface GlobalWorkspace
Returns:
the tick when the last broadcast occurred

setRefractoryPeriod

public void setRefractoryPeriod(int period)
Sets refractoryPeriod

Specified by:
setRefractoryPeriod in interface RefractoryPeriod
Parameters:
period - number of ticks that must pass after a broadcast has been sent before a new one can be sent.
See Also:
TaskManager

getCoalitionRemovalThreshold

public double getCoalitionRemovalThreshold()
Description copied from interface: GlobalWorkspace
Gets coalition removal threshold

Specified by:
getCoalitionRemovalThreshold in interface GlobalWorkspace
Returns:
lower bound for coalitions to remain in the GlobalWorkspace

setCoalitionRemovalThreshold

public void setCoalitionRemovalThreshold(double coalitionRemovalThreshold)
Description copied from interface: GlobalWorkspace
Sets coalition removal threshold

Specified by:
setCoalitionRemovalThreshold in interface GlobalWorkspace
Parameters:
coalitionRemovalThreshold - lower bound for coalitions to remain in the GlobalWorkspace

getCoalitionDecayStrategy

public DecayStrategy getCoalitionDecayStrategy()
Description copied from interface: GlobalWorkspace
Gets coalitionDecayStrategy

Specified by:
getCoalitionDecayStrategy in interface GlobalWorkspace
Returns:
DecayStrategy by which coalitions will be decayed.

setCoalitionDecayStrategy

public void setCoalitionDecayStrategy(DecayStrategy coalitionDecayStrategy)
Description copied from interface: GlobalWorkspace
Sets coalitionDecayStrategy

Specified by:
setCoalitionDecayStrategy in interface GlobalWorkspace
Parameters:
coalitionDecayStrategy - DecayStrategy by which coalitions will be decayed.