public class WorkingStorage extends java.lang.Object implements Subject
Constructor and Description |
---|
WorkingStorage(int maxCapacity,
RawMemory rawMemory) |
Modifier and Type | Method and Description |
---|---|
void |
clearWithDelete()
Removes all memory objects from Working Memory and delete them from raw memory.
|
java.lang.Object |
clone()
Avoids cloning
|
boolean |
contains(Memory mo) |
java.util.ArrayList<Memory> |
getAll() |
java.util.ArrayList<Memory> |
getAllOfType(java.lang.String type)
Returns a list of all memory objects of a given type.
|
int |
getMaxCapacity() |
void |
notifyCodelets() |
void |
printStatus()
Prints all memory objects in Working Storage, organized by TYPE.
|
void |
putMemoryObject(Memory mo)
Adds a memory object to working storage
|
void |
registerCodelet(Codelet co,
java.lang.String type,
int io)
Registers a codelet's input or output list to receive notifications from working storage.
|
void |
removeFromWorkingStorageWithDelete(Memory bpMo)
WARNING!
Removes this memory object from Working Storage if it is there, and also removes it from Raw Memory
|
void |
removeFromWorkingStorageWithoutDelete(Memory mo)
Removes this memory object from Working Storage if it is there, but keeps it in Raw Memory.
|
void |
setMaxCapacity(int maxCapacity) |
void |
shutDown()
Destroys all memory object from WorkingStorage.
|
void |
unregisterCodelet(Codelet co,
java.lang.String type,
int io)
Removes a codelet's io from the subject registered list
|
public WorkingStorage(int maxCapacity, RawMemory rawMemory)
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public java.util.ArrayList<Memory> getAllOfType(java.lang.String type)
type
- of the wished memory objectspublic void setMaxCapacity(int maxCapacity)
maxCapacity
- the maxCapacity to setpublic int getMaxCapacity()
public void printStatus()
public java.util.ArrayList<Memory> getAll()
public boolean contains(Memory mo)
public void putMemoryObject(Memory mo)
mo
- one memory object to be addedpublic void removeFromWorkingStorageWithoutDelete(Memory mo)
mo
- public void removeFromWorkingStorageWithDelete(Memory bpMo)
bpMo
- public void clearWithDelete()
public void registerCodelet(Codelet co, java.lang.String type, int io)
Subject
registerCodelet
in interface Subject
co
- Codelettype
- Type of memory objects being observedio
- Which list to register: 0 - input and 1 - outputpublic void unregisterCodelet(Codelet co, java.lang.String type, int io)
Subject
unregisterCodelet
in interface Subject
public void notifyCodelets()
notifyCodelets
in interface Subject
public void shutDown()