edu.memphis.ccrg.lida.framework
Class FrameworkModuleImpl

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

public abstract class FrameworkModuleImpl
extends java.lang.Object
implements FrameworkModule

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

Author:
Javier Snaider

Field Summary
protected  TaskSpawner taskSpawner
          TaskSpawner used by this module
 
Constructor Summary
FrameworkModuleImpl()
          Default constructor
 
Method Summary
 void addListener(ModuleListener listener)
          Override this method to add a listener to the module
 void addSubModule(FrameworkModule lm)
          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.
 java.lang.Object getParam(java.lang.String name, java.lang.Object defaultValue)
          A convenience method to read parameters from the Map of properties set with the init() method.
 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 init()
          Implementations should only perform initialization of variables or objects that depend on parameters in the parameter map specified in init(Map).
 void init(java.util.Map<java.lang.String,?> params)
          This method initializes the module with parameters specified in agent.xml
 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 moduleName)
          Sets ModuleName.
 void taskManagerDecayModule(long ticks)
          Framework users should not call this method.
 java.lang.String 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
decayModule
 

Field Detail

taskSpawner

protected TaskSpawner taskSpawner
TaskSpawner used by this module

Constructor Detail

FrameworkModuleImpl

public FrameworkModuleImpl()
Default constructor

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

init

public void init(java.util.Map<java.lang.String,?> params)
Description copied from interface: Initializable
This method initializes the module with parameters specified in agent.xml

Specified by:
init in interface Initializable
Parameters:
params - Map of parameters indexed by String names

init

public void init()
Implementations should only perform initialization of variables or objects that depend on parameters in the parameter map specified in init(Map). Furthermore they should not try to access modules added via setAssociatedModule(FrameworkModule, String) as this method will not have run yet at the time this method is called.

Specified by:
init in interface Initializable

getParam

public java.lang.Object getParam(java.lang.String name,
                                 java.lang.Object defaultValue)
Description copied from interface: Initializable
A convenience method to read parameters from the Map of properties set with the init() method.

Specified by:
getParam in interface Initializable
Parameters:
name - the parameter name
defaultValue - the default value to be returned if the parameter doesn't exist.
Returns:
the value of the parameter or the default value.

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

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.

addSubModule

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

Specified by:
addSubModule in interface FrameworkModule
Parameters:
lm - 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 moduleName)
Description copied from interface: FrameworkModule
Sets ModuleName.

Specified by:
setModuleName in interface FrameworkModule
Parameters:
moduleName - 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 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 - - specifies what content will be returned.
Returns:
various kinds of content of this module.