CellType - The type of the memory cell. It can be any object.public interface MemoryContext<CellType> extends Context
| Modifier and Type | Method and Description |
|---|---|
void |
addMemoryListener(Memory.MemoryListener listener)
Adds the specified memory listener to receive memory events from this memory.
|
boolean |
areMemoryNotificationsEnabled()
Determine if notifications of memory changes are globally enabled or disabled.
|
void |
clear()
Clears the memory.
|
Class<?> |
getDataType()
Get the type of memory cells.
|
int |
getSize()
Get memory size.
|
CellType |
read(int memoryPosition)
Reads one cell from a memory.
|
CellType[] |
readWord(int memoryPosition)
Reads two adjacent cells from a memory at once.
|
void |
removeMemoryListener(Memory.MemoryListener listener)
Removes the specified memory listener so that it no longer receives memory
events from this memory.
|
void |
setMemoryNotificationsEnabled(boolean enabled)
Enable/disable notifications of memory changes globally.
|
void |
write(int memoryPosition,
CellType value)
Write one cell-size (e.g.
|
void |
writeWord(int memoryPosition,
CellType[] value)
Write two cell-size (e.g.
|
CellType read(int memoryPosition)
memoryPosition - memory position (address) of the read cellCellType[] readWord(int memoryPosition)
short), concatenation
can be realized as (in small endian):
result = (mem[from]&0xFF) | ((mem[from+1]<<8)&0xFF);
and in big endian as:
result = ((mem[from]<<8)&0xFF) | (mem[from+1]&0xFF);
memoryPosition - memory position (address) of the read cellsvoid write(int memoryPosition,
CellType value)
memoryPosition - memory position (address) of the cell where data will be writtenvalue - data to be writtenvoid writeWord(int memoryPosition,
CellType[] value)
memoryPosition - memory position (address) of the cell with index 0value - two cells at indexes 0 and 1, respectively.Class<?> getDataType()
void clear()
void addMemoryListener(Memory.MemoryListener listener)
null, no exception is thrown and no action is
performed.listener - the memory listenervoid removeMemoryListener(Memory.MemoryListener listener)
null, no exception is
thrown and no action is performed.listener - the memory listener to be removedint getSize()
void setMemoryNotificationsEnabled(boolean enabled)
enabled - - true if enabled, false if disabled.boolean areMemoryNotificationsEnabled()
Copyright © 2017. All rights reserved.