Package dev.zemco.codegame.programs
Class InstructionDescriptor
java.lang.Object
dev.zemco.codegame.programs.InstructionDescriptor
Instruction descriptors provide additional context to individual
instructions during
the program execution.
Instruction descriptors are immutable.
- Author:
- Erik Zemčík
-
Constructor Summary
ConstructorsConstructorDescriptionInstructionDescriptor(IInstruction instruction, int linePosition) Creates an instance ofInstructionDescriptorfor a specificinstruction. -
Method Summary
Modifier and TypeMethodDescriptionReturns theinstructionthis descriptor provides the additional context for.intReturns the zero-based line position associated with theinstruction.
-
Constructor Details
-
InstructionDescriptor
Creates an instance ofInstructionDescriptorfor a specificinstruction.- Parameters:
instruction- instruction to provide context forlinePosition- zero-based line position associated with the instruction- Throws:
IllegalArgumentException- ifinstructionisnullor iflinePositionis not a positive integer
-
-
Method Details
-
getInstruction
Returns theinstructionthis descriptor provides the additional context for.- Returns:
- instruction
-
getLinePosition
public int getLinePosition()Returns the zero-based line position associated with theinstruction.- Returns:
- zero-based line position
-