Package ptolemy.domains.taskpt.lib
Class Memory
- java.lang.Object
-
- ptolemy.kernel.util.NamedObj
-
- ptolemy.domains.taskpt.lib.Memory
-
- All Implemented Interfaces:
java.lang.Cloneable
,Changeable
,Debuggable
,DebugListener
,Derivable
,ModelErrorHandler
,MoMLExportable
,Moveable
,Nameable
public class Memory extends NamedObj
An object that is a buffer for Tokens. This is used in the taskpt domain to model a shared memory.- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Bastian Ristau
- Pt.AcceptedRating:
- red (ristau)
- Pt.ProposedRating:
- red (ristau)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class ptolemy.kernel.util.NamedObj
NamedObj.ContainedObjectsIterator
-
-
Field Summary
-
Fields inherited from class ptolemy.kernel.util.NamedObj
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
-
-
Constructor Summary
Constructors Constructor Description Memory()
Construct a memory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PtrToken
allocate(int size)
Allocate a slot in the memory (currently at the end).void
clear()
Remove all entries from the memory.Token
read(int index)
Read a token from the given address in this memory.void
write(int index, Token token)
Write a token into the specified memory address given by index.-
Methods inherited from class ptolemy.kernel.util.NamedObj
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getContainedObject, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateExistence, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getContainer, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setName, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
-
-
-
-
Method Detail
-
allocate
public PtrToken allocate(int size)
Allocate a slot in the memory (currently at the end).- Parameters:
size
- The size of the slot to be allocated.- Returns:
- A pointer to the address allocated in the memory.
-
clear
public void clear()
Remove all entries from the memory.
-
read
public Token read(int index)
Read a token from the given address in this memory.- Parameters:
index
- The address to be read.- Returns:
- The token, if there is one located at that address. If not or index is exceeding the memory capacity, then null is returned.
-
write
public void write(int index, Token token)
Write a token into the specified memory address given by index. If memory capacity is smaller than the given address, the memory is extended automatically.- Parameters:
index
- The address to be written.token
- The token to be written.
-
-