Class JumpIfZeroInstruction
java.lang.Object
dev.zemco.codegame.execution.instructions.JumpInstruction
dev.zemco.codegame.execution.instructions.JumpIfZeroInstruction
- All Implemented Interfaces:
IInstruction
Instruction that performs a jump of the
engine to the specified label if
the value of the working memory cell is equal to zero.- Author:
- Erik Zemčík
-
Constructor Summary
ConstructorsConstructorDescriptionJumpIfZeroInstruction(String label) Creates an instance ofJumpIfZeroInstructionwith the target jump label. -
Method Summary
Modifier and TypeMethodDescriptionprotected booleanshouldPerformJump(IExecutionContext executionContext) Checks if the value of the workingmemory cellis equal to zero.Methods inherited from class dev.zemco.codegame.execution.instructions.JumpInstruction
execute
-
Constructor Details
-
JumpIfZeroInstruction
Creates an instance ofJumpIfZeroInstructionwith the target jump label.- Parameters:
label- target label of the jump- Throws:
IllegalArgumentException- iflabelisnullor empty
-
-
Method Details
-
shouldPerformJump
protected boolean shouldPerformJump(IExecutionContext executionContext) throws InstructionExecutionException Checks if the value of the workingmemory cellis equal to zero.- Overrides:
shouldPerformJumpin classJumpInstruction- Parameters:
executionContext- context on which the instruction is executed- Returns:
- true if the value of the working
memory cellis equal to zero, else false - Throws:
InstructionExecutionException- if the workingmemory cellholds no value
-