org.pandora.knowledge
Class BasicMemory

java.lang.Object
  extended by org.pandora.knowledge.BasicMemory
All Implemented Interfaces:
Memory
Direct Known Subclasses:
DatabaseMemory, SerializedMemory, XMLMemory

public class BasicMemory
extends java.lang.Object
implements Memory

Defines a set of networks that make up a knowledge base. Defines long term, short term and flash networks. Basic implementation to allow subclasses to avoid defining some of the basic stuff, Note this basic implementation is not persistent.


Constructor Summary
BasicMemory()
           
 
Method Summary
 void abort()
          Reset the short term and active memories.
 Vertex addActiveMemory(Vertex vertex)
          Add the sensory data to the active memory.
 void addListener(MemoryEventListener listener)
          Add the memory listener.
 void createMemory(java.lang.String database)
          Create a memory database.
 void deleteMemory()
          Delete all content from the database.
 void destroyMemory(java.lang.String database)
          Destroy the database.
 java.util.Queue<Vertex> getActiveMemory()
          Active memory represents the last sensory state.
 java.util.List<MemoryEventListener> getListeners()
           
 Network getLongTermMemory()
          Represents the persisted memory (or cache there of).
 java.lang.String getMemoryName()
          Return the current connected database name.
 Pandora getPandora()
          Return Pandora.
 Network getShortTermMemory()
          Represents a non-committed transactional memory.
 void importMemory(java.lang.String location)
          Allow import of another memory location.
 void initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
          Initialize any configurable settings from the properties.
 Network newMemory()
          Return an isolated transactional memory.
 void restore()
          This implementation does not support persistence.
 void restore(java.lang.String database)
          This implementation does not support persistence.
 void save()
          Merge the short term memory into the long term and clears the short term.
 void setActiveMemory(java.util.Queue<Vertex> activeMemory)
           
 void setLongTermMemory(Network longTermMemory)
           
 void setPandora(Pandora pandora)
          Set Pandora.
 void setShortTermMemory(Network shortTermMemory)
           
 void shutdown()
          Shutdown the memory.
 void switchMemory(java.lang.String location)
          Allow switching to another memory location.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BasicMemory

public BasicMemory()
Method Detail

getMemoryName

public java.lang.String getMemoryName()
Return the current connected database name.

Specified by:
getMemoryName in interface Memory

getPandora

public Pandora getPandora()
Return Pandora.

Specified by:
getPandora in interface Memory

setPandora

public void setPandora(Pandora pandora)
Set Pandora.

Specified by:
setPandora in interface Memory

initialize

public void initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
Initialize any configurable settings from the properties.

Specified by:
initialize in interface Memory

getActiveMemory

public java.util.Queue<Vertex> getActiveMemory()
Active memory represents the last sensory state.

Specified by:
getActiveMemory in interface Memory

addActiveMemory

public Vertex addActiveMemory(Vertex vertex)
Add the sensory data to the active memory. Register the vertex in the short-term memory and return the registered version.

Specified by:
addActiveMemory in interface Memory

getShortTermMemory

public Network getShortTermMemory()
Represents a non-committed transactional memory. Helps to define a learn scope and local context.

Specified by:
getShortTermMemory in interface Memory

newMemory

public Network newMemory()
Return an isolated transactional memory. Can be used by senses or sub-conscious thought for concurrent processing.

Specified by:
newMemory in interface Memory

getLongTermMemory

public Network getLongTermMemory()
Represents the persisted memory (or cache there of).

Specified by:
getLongTermMemory in interface Memory

setActiveMemory

public void setActiveMemory(java.util.Queue<Vertex> activeMemory)

setShortTermMemory

public void setShortTermMemory(Network shortTermMemory)

setLongTermMemory

public void setLongTermMemory(Network longTermMemory)

save

public void save()
Merge the short term memory into the long term and clears the short term. This is similar to a transactional commit. The changes should also be persisted, as the long term should always just be a cache of the storage. This implementation does not support persistence.

Specified by:
save in interface Memory

restore

public void restore()
This implementation does not support persistence.

Specified by:
restore in interface Memory

restore

public void restore(java.lang.String database)
This implementation does not support persistence.

Specified by:
restore in interface Memory

createMemory

public void createMemory(java.lang.String database)
Create a memory database.

Specified by:
createMemory in interface Memory

destroyMemory

public void destroyMemory(java.lang.String database)
Destroy the database.

Specified by:
destroyMemory in interface Memory

deleteMemory

public void deleteMemory()
Delete all content from the database.

Specified by:
deleteMemory in interface Memory

importMemory

public void importMemory(java.lang.String location)
Allow import of another memory location.

Specified by:
importMemory in interface Memory

switchMemory

public void switchMemory(java.lang.String location)
Allow switching to another memory location.

Specified by:
switchMemory in interface Memory

shutdown

public void shutdown()
Shutdown the memory.

Specified by:
shutdown in interface Memory

abort

public void abort()
Reset the short term and active memories. Revert to the long term state.

Specified by:
abort in interface Memory

toString

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

getListeners

public java.util.List<MemoryEventListener> getListeners()

addListener

public void addListener(MemoryEventListener listener)
Add the memory listener. It will be notified of any new active memory.

Specified by:
addListener in interface Memory