edu.memphis.ccrg.lida.framework
Class FrameworkModuleImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
      extended by edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
All Implemented Interfaces:
FrameworkModule, FullyInitializable, Initializable
Direct Known Subclasses:
AgentImpl, AttentionCodeletModule, BasicActionSelection, BasicSensoryMotorMemory, BehaviorNetwork, BroadcastQueueImpl, EnvironmentImpl, EpisodicMemoryImpl, GlobalWorkspaceImpl, PerceptualAssociativeMemoryImpl, ProceduralMemoryImpl, SensoryMemoryImpl, StructureBuildingCodeletModule, WorkspaceBufferImpl, WorkspaceImpl

public abstract class FrameworkModuleImpl
extends InitializableImpl
implements FrameworkModule

Abstract implementation of FrameworkModule Implementations should add themselves to the agent.xml configuration file

Author:
Javier Snaider, Ryan J. McCall

Field Summary
protected  TaskSpawner taskSpawner
          TaskSpawner used by this module
 
Constructor Summary
FrameworkModuleImpl()
          Default constructor
FrameworkModuleImpl(ModuleName name)
          Creates a FrameworkModule with specified module name.
 
Method Summary
 void addListener(ModuleListener listener)
          Override this method to add a listener to the module
 void addSubModule(FrameworkModule module)
          Adds submodule as a component of this FrameworkModule.
 boolean containsSubmodule(ModuleName name)
          Returns whether this FrameworkModule contains a submodule with specified ModuleName.
 boolean containsSubmodule(java.lang.String name)
          Returns whether this FrameworkModule contains a submodule with specified name.
 TaskSpawner getAssistingTaskSpawner()
          Returns the TaskSpawner which this FrameworkModule uses to spawn tasks.
 java.lang.Object getModuleContent(java.lang.Object... params)
          Intended to be called from the GUI.
 ModuleName getModuleName()
          Gets moduleName.
 FrameworkModule getSubmodule(ModuleName name)
          Gets specified submodule subModule.
 FrameworkModule getSubmodule(java.lang.String name)
          Gets specified submodule.
 java.util.Map<ModuleName,FrameworkModule> getSubmodules()
          Convenience method to get submodules
 void setAssistingTaskSpawner(TaskSpawner ts)
          Specify the TaskSpawner which this FrameworkModule will use to spawn tasks.
 void setAssociatedModule(FrameworkModule module, java.lang.String moduleUsage)
          Sets an associated FrameworkModule.
 void setModuleName(ModuleName name)
          Sets ModuleName.
 void taskManagerDecayModule(long ticks)
          Framework users should not call this method.
 java.lang.String toString()
           
 
Methods inherited from class edu.memphis.ccrg.lida.framework.initialization.InitializableImpl
containsParameter, getParam, getParameters, init, init
 
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
decayModule
 
Methods inherited from interface edu.memphis.ccrg.lida.framework.initialization.Initializable
containsParameter, getParam, getParameters, init, init
 

Field Detail

taskSpawner

protected TaskSpawner taskSpawner
TaskSpawner used by this module

Constructor Detail

FrameworkModuleImpl

public FrameworkModuleImpl()
Default constructor


FrameworkModuleImpl

FrameworkModuleImpl(ModuleName name)
Creates a FrameworkModule with specified module name. It is generally preferable to use the default constructor instead of this one since the ModuleName is typically specified by agent.xml and set by AgentXmlFactory

Parameters:
name - ModuleName of this FrameworkModule
See Also:
AgentXmlFactory
Method Detail

setAssistingTaskSpawner

public void setAssistingTaskSpawner(TaskSpawner ts)
Description copied from interface: FrameworkModule
Specify the TaskSpawner which this FrameworkModule will use to spawn tasks.

Specified by:
setAssistingTaskSpawner in interface FrameworkModule
Parameters:
ts - the TaskSpawner

getAssistingTaskSpawner

public TaskSpawner getAssistingTaskSpawner()
Description copied from interface: FrameworkModule
Returns the TaskSpawner which this FrameworkModule uses to spawn tasks.

Specified by:
getAssistingTaskSpawner in interface FrameworkModule
Returns:
the assisting task spawner

getSubmodule

public FrameworkModule getSubmodule(ModuleName name)
Description copied from interface: FrameworkModule
Gets specified submodule subModule.

Specified by:
getSubmodule in interface FrameworkModule
Parameters:
name - name of the desired submodule.
Returns:
the submodule.

getSubmodule

public FrameworkModule getSubmodule(java.lang.String name)
Description copied from interface: FrameworkModule
Gets specified submodule.

Specified by:
getSubmodule in interface FrameworkModule
Parameters:
name - name of the desired submodule.
Returns:
the submodule.

containsSubmodule

public boolean containsSubmodule(ModuleName name)
Description copied from interface: FrameworkModule
Returns whether this FrameworkModule contains a submodule with specified ModuleName.

Specified by:
containsSubmodule in interface FrameworkModule
Parameters:
name - ModuleName of submodule
Returns:
true if there is a FrameworkModule with specified ModuleName in this FrameworkModule

containsSubmodule

public boolean containsSubmodule(java.lang.String name)
Description copied from interface: FrameworkModule
Returns whether this FrameworkModule contains a submodule with specified name.

Specified by:
containsSubmodule in interface FrameworkModule
Parameters:
name - ModuleName of submodule
Returns:
true if there is a FrameworkModule with specified name in this FrameworkModule

addSubModule

public void addSubModule(FrameworkModule module)
Description copied from interface: FrameworkModule
Adds submodule as a component of this FrameworkModule.

Specified by:
addSubModule in interface FrameworkModule
Parameters:
module - submodule to add

getSubmodules

public java.util.Map<ModuleName,FrameworkModule> getSubmodules()
Description copied from interface: FrameworkModule
Convenience method to get submodules

Specified by:
getSubmodules in interface FrameworkModule
Returns:
map of submodules by ModuleName

taskManagerDecayModule

public void taskManagerDecayModule(long ticks)
Framework users should not call this method. It will be called by the TaskManager. Decays this module and all its submodules. Subclasses overriding this method must call this method first in order to have all submodules decayed.

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

setModuleName

public void setModuleName(ModuleName name)
Description copied from interface: FrameworkModule
Sets ModuleName.

Specified by:
setModuleName in interface FrameworkModule
Parameters:
name - ModuleName of this FrameworkModule

getModuleName

public ModuleName getModuleName()
Description copied from interface: FrameworkModule
Gets moduleName.

Specified by:
getModuleName in interface FrameworkModule
Returns:
ModuleName of this FrameworkModule

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setAssociatedModule

public void setAssociatedModule(FrameworkModule module,
                                java.lang.String moduleUsage)
Description copied from interface: FullyInitializable
Sets an associated FrameworkModule.

Specified by:
setAssociatedModule in interface FullyInitializable
Parameters:
module - the module to be associated.
moduleUsage - how module will be used
See Also:
ModuleUsage

addListener

public void addListener(ModuleListener listener)
Override this method to add a listener to the module

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

getModuleContent

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

Specified by:
getModuleContent in interface FrameworkModule
Parameters:
params - parameters specifying what content will be returned
Returns:
Parameter-specified content of this module.