Class ConstantSizeMemory
java.lang.Object
dev.zemco.codegame.execution.memory.ConstantSizeMemory
- All Implemented Interfaces:
IMemory
Memory holding constant number of
memory cells specified during its creation.- Author:
- Erik Zemčík
-
Constructor Summary
ConstructorsConstructorDescriptionConstantSizeMemory(int size, IMemoryCellFactory memoryCellFactory) Creates an instance ofConstantSizeMemorythat holds a specified number ofmemory cellscreated using the providedmemoryCellFactory. -
Method Summary
Modifier and TypeMethodDescriptiongetCellByAddress(int address) Retrieves acellat the specified address.Retrieves the workingcell.
-
Constructor Details
-
ConstantSizeMemory
Creates an instance ofConstantSizeMemorythat holds a specified number ofmemory cellscreated using the providedmemoryCellFactory.- Parameters:
size- number of cells which memory should holdmemoryCellFactory- factory to use to create new memory cells- Throws:
IllegalArgumentException- ifsizeis not a positive non-zero integer or ifmemoryCellFactoryisnull
-
-
Method Details
-
getCellByAddress
Description copied from interface:IMemoryRetrieves acellat the specified address.- Specified by:
getCellByAddressin interfaceIMemory- Parameters:
address- address of the cell to return- Returns:
- cell at the specified address
-
getWorkingCell
Description copied from interface:IMemoryRetrieves the workingcell.- Specified by:
getWorkingCellin interfaceIMemory- Returns:
- working cell
-