|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectfi.hu.cs.titokone.RandomAccessMemory
This class represents the memory of a TTK-91 computer.
Field Summary | |
private int |
codeAreaSize
|
private int |
dataAreaSize
|
private MemoryLine[] |
memory
|
private int |
size
|
private SymbolTable |
symbols
|
Constructor Summary | |
RandomAccessMemory(int size)
Creates a memory with a given size and initializes it with rows containing 0. |
Method Summary | |
int[] |
getCodeArea()
Returns a code area dump. |
int |
getCodeAreaSize()
Returns the size of the code area. |
int[] |
getDataArea()
Returns a data area dump. |
int |
getDataAreaSize()
Returns the size of the data area. |
int[] |
getMemory()
Returns a memory dump. |
MemoryLine |
getMemoryLine(int index)
Returns memory line at given slot. |
MemoryLine[] |
getMemoryLines()
This method returns a copy of all the memory lines. |
int |
getSize()
Returns the size of the memory. |
java.util.HashMap |
getSymbolTable()
Returns the symbol table of currently used symbols as a hashmap, with String names of the symbols as keys referencing the Integer values of the symbols. |
int |
getValue(int memorySlot)
Returns the value of an indexed memory slot. |
void |
setCodeAreaLength(int size)
Sets the size of the code area. |
void |
setDataAreaLength(int size)
Sets the size of the data area. |
void |
setMemoryLine(int index,
MemoryLine memoryLine)
Sets new memory line to given memory slot. |
void |
setSymbolTable(SymbolTable symbols)
Changes the symbol table stored in this class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private SymbolTable symbols
private int size
private MemoryLine[] memory
private int codeAreaSize
private int dataAreaSize
Constructor Detail |
public RandomAccessMemory(int size)
size
- Size of the memory.Method Detail |
public int getSize()
getSize
in interface TTK91Memory
public int getValue(int memorySlot)
getValue
in interface TTK91Memory
memorySlot
- memory address where required data is
public java.util.HashMap getSymbolTable()
getSymbolTable
in interface TTK91Memory
public int[] getMemory()
getMemory
in interface TTK91Memory
public int[] getCodeArea()
getCodeArea
in interface TTK91Memory
public int[] getDataArea()
getDataArea
in interface TTK91Memory
public int getCodeAreaSize()
public int getDataAreaSize()
public MemoryLine getMemoryLine(int index)
index
- Index to memory.
public MemoryLine[] getMemoryLines()
public void setSymbolTable(SymbolTable symbols)
symbols
- The new symboltable to store here.public void setMemoryLine(int index, MemoryLine memoryLine) throws TTK91AddressOutOfBounds
index
- Index to memory.memoryLine
- New memory line which will replace the old.
TTK91AddressOutOfBounds
public void setCodeAreaLength(int size)
size
- Size of the code area.public void setDataAreaLength(int size)
size
- Size of the data area.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |