Interface IMemory

All Known Implementing Classes:
ConstantSizeMemory

public interface IMemory
Collection of memory cells which can hold an integer value. Each cell can be accessed using its address.

Memory also contains working cell, that has a special position during execution as it is used as target variable for some instructions. Working cell can be accessed either through dedicated method getWorkingCell() or its constant address 0.

Author:
Erik Zemčík
See Also:
  • Method Details

    • getCellByAddress

      IMemoryCell getCellByAddress(int address)
      Retrieves a cell at the specified address.
      Parameters:
      address - address of the cell to return
      Returns:
      cell at the specified address
      Throws:
      IndexOutOfBoundsException - if address is out of range of the memory
    • getWorkingCell

      IMemoryCell getWorkingCell()
      Retrieves the working cell.
      Returns:
      working cell