Class CopyFromInstruction
java.lang.Object
dev.zemco.codegame.execution.instructions.AbstractCopyInstruction
dev.zemco.codegame.execution.instructions.CopyFromInstruction
- All Implemented Interfaces:
IInstruction
Instruction that copies value from target
memory cell to working memory cell.- Author:
- Erik Zemčík
-
Constructor Summary
ConstructorsConstructorDescriptionCopyFromInstruction(int sourceCellAddress) Creates an instance ofCopyFromInstructionthat copies values frommemory cellat a given address. -
Method Summary
Modifier and TypeMethodDescriptionprotected IMemoryCellgetDestinationMemoryCell(IMemory memory) Retrieves the destinationmemory cellfor copying.protected IMemoryCellgetSourceMemoryCell(IMemory memory) Retrieves the sourcememory cellfor copying.Methods inherited from class dev.zemco.codegame.execution.instructions.AbstractCopyInstruction
execute, getMemoryCellAtAddress
-
Constructor Details
-
CopyFromInstruction
public CopyFromInstruction(int sourceCellAddress) Creates an instance ofCopyFromInstructionthat copies values frommemory cellat a given address.- Parameters:
sourceCellAddress- address of the sourcememory cell- Throws:
IllegalArgumentException- ifsourceCellAddressis not a positive integer
-
-
Method Details
-
getSourceMemoryCell
Description copied from class:AbstractCopyInstructionRetrieves the sourcememory cellfor copying.- Specified by:
getSourceMemoryCellin classAbstractCopyInstruction- Parameters:
memory- source ofmemory cells- Returns:
- source
memory cell - Throws:
InstructionExecutionException- if the sourcememory cellcould not be retrieved
-
getDestinationMemoryCell
Description copied from class:AbstractCopyInstructionRetrieves the destinationmemory cellfor copying.- Specified by:
getDestinationMemoryCellin classAbstractCopyInstruction- Parameters:
memory- source ofmemory cells- Returns:
- destination
memory cell
-