Class CopyToInstruction
java.lang.Object
dev.zemco.codegame.execution.instructions.AbstractCopyInstruction
dev.zemco.codegame.execution.instructions.CopyToInstruction
- All Implemented Interfaces:
IInstruction
Instruction that copies value from working
memory cell to target memory cell.- Author:
- Erik Zemčík
-
Constructor Summary
ConstructorsConstructorDescriptionCopyToInstruction(int destinationCellAddress) Creates an instance ofCopyToInstructionthat copies values intomemory 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
-
CopyToInstruction
public CopyToInstruction(int destinationCellAddress) Creates an instance ofCopyToInstructionthat copies values intomemory cellat a given address.- Parameters:
destinationCellAddress- address of the destinationmemory cell- Throws:
IllegalArgumentException- ifdestinationCellAddressis 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
-
getDestinationMemoryCell
Description copied from class:AbstractCopyInstructionRetrieves the destinationmemory cellfor copying.- Specified by:
getDestinationMemoryCellin classAbstractCopyInstruction- Parameters:
memory- source ofmemory cells- Returns:
- destination
memory cell - Throws:
InstructionExecutionException- if the destinationmemory cellcould not be retrieved
-