Package dev.zemco.codegame.programs
Class Program
java.lang.Object
dev.zemco.codegame.programs.Program
Program is a set of instructions to be followed during execution.
Each program consists of
instruction descriptors and
jump label mappings.
Programs may be solutions to problems created by the player. Programs are immutable.
- Author:
- Erik Zemčík
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturnsinstruction descriptorsof this program, ordered in a way they should be executed.Returns jump label to line position mappings used for jumping to a specific position during execution.
-
Constructor Details
-
Program
public Program(List<InstructionDescriptor> instructionDescriptors, Map<String, Integer> jumpLabelToLinePositionMap) Creates an instance ofProgram.- Parameters:
instructionDescriptors- instruction descriptorslistof this program, ordered in a way they should be executedjumpLabelToLinePositionMap- jump label to line positionmapof this program- Throws:
IllegalArgumentException- ifinstructionDescriptorsisnullor ifjumpLabelToLinePositionMapisnull
-
-
Method Details
-
getInstructionDescriptors
Returnsinstruction descriptorsof this program, ordered in a way they should be executed.- Returns:
- unmodifiable
listofinstruction descriptors
-
getJumpLabelToLinePositionMap
Returns jump label to line position mappings used for jumping to a specific position during execution.- Returns:
- unmodifiable
mapof jump label mappings
-