edu.memphis.ccrg.lida.episodicmemory
Class EpisodicMemoryImpl

java.lang.Object
  extended by edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
      extended by edu.memphis.ccrg.lida.episodicmemory.EpisodicMemoryImpl
All Implemented Interfaces:
CueListener, EpisodicMemory, FrameworkModule, FullyInitializable, Initializable, ModuleListener, BroadcastListener

public class EpisodicMemoryImpl
extends FrameworkModuleImpl
implements EpisodicMemory, BroadcastListener, CueListener

This is the canonical implementation of EpisodicMemory. It uses a sparse distributed memory to store the information.

Author:
Javier Snaider

Field Summary
static int DEF_ACCESS_RADIUS
          Default access radius for SparseDistributedMemory
static int DEF_ADDRESS_LENGTH
          Default address length for SparseDistributedMemory
static int DEF_HARD_LOCATIONS
          Default number of hard locations
static int DEF_WORD_LENGTH
          Default word length for SparseDistributedMemory
 
Fields inherited from class edu.memphis.ccrg.lida.framework.FrameworkModuleImpl
taskSpawner
 
Constructor Summary
EpisodicMemoryImpl()
          Default constructor
 
Method Summary
 void addListener(ModuleListener listener)
          Override this method to add a listener to the module
 void decayModule(long ticks)
          Decay only this Module.
 java.lang.Object getModuleContent(java.lang.Object... params)
          Intended to be called from the GUI.
 SparseDistributedMemory getSdm()
          Returns the SDM used in this EpisodicMemory
 Translator getTranslator()
          Returns the Translator associated with this EpisodicMemoryImpl
 void init()
          Will set parameters with the following names:

tem.numOfHardLoc
tem.addressLength
tem.wordLength
tem.activationRadius
 void learn(BroadcastContent content)
          This is a placeholder method to remind implementing classes that they should implement learning.
 void receiveBroadcast(BroadcastContent bc)
          This method should return as possible in order to not delay the rest of the broadcasting.
 void receiveCue(NodeStructure ns)
          Receive a cue as a NodeStructure In this implementation, first the cue is translated to a BitVector.
 void setTranslator(Translator translator)
          Sets the Translator of this EpisodicMemoryImpl
 
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
 

Field Detail

DEF_HARD_LOCATIONS

public static final int DEF_HARD_LOCATIONS
Default number of hard locations

See Also:
Constant Field Values

DEF_ADDRESS_LENGTH

public static final int DEF_ADDRESS_LENGTH
Default address length for SparseDistributedMemory

See Also:
Constant Field Values

DEF_WORD_LENGTH

public static final int DEF_WORD_LENGTH
Default word length for SparseDistributedMemory

See Also:
Constant Field Values

DEF_ACCESS_RADIUS

public static final int DEF_ACCESS_RADIUS
Default access radius for SparseDistributedMemory

See Also:
Constant Field Values
Constructor Detail

EpisodicMemoryImpl

public EpisodicMemoryImpl()
Default constructor

Method Detail

init

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

tem.numOfHardLoc
tem.addressLength
tem.wordLength
tem.activationRadius

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

receiveBroadcast

public void receiveBroadcast(BroadcastContent bc)
Description copied from interface: BroadcastListener
This method should return as possible in order to not delay the rest of the broadcasting. A good implementation should copy the broadcast content and create a task to process it.

Specified by:
receiveBroadcast in interface BroadcastListener
Parameters:
bc - the Content of the Broadcast

receiveCue

public void receiveCue(NodeStructure ns)
Receive a cue as a NodeStructure In this implementation, first the cue is translated to a BitVector.

Specified by:
receiveCue in interface CueListener
Parameters:
ns - NodeStructure to retrieve
See Also:
Translator

learn

public void learn(BroadcastContent content)
Description copied from interface: BroadcastListener
This is a placeholder method to remind implementing classes that they should implement learning. LIDA theory says receivers of the broadcast should learn from it. This method will not be called directly by GlobalWorkspace but should be managed by the receiving module.

Specified by:
learn in interface BroadcastListener
Parameters:
content - content

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.

setTranslator

public void setTranslator(Translator translator)
Sets the Translator of this EpisodicMemoryImpl

Parameters:
translator - the Translator to set

getTranslator

public Translator getTranslator()
Returns the Translator associated with this EpisodicMemoryImpl

Returns:
the Translator

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.

getSdm

public SparseDistributedMemory getSdm()
Returns the SDM used in this EpisodicMemory

Returns:
the SDM