Class InstructionDescriptor

java.lang.Object
dev.zemco.codegame.programs.InstructionDescriptor

public class InstructionDescriptor extends Object
Instruction descriptors provide additional context to individual instructions during the program execution.

Instruction descriptors are immutable.

Author:
Erik Zemčík
  • Constructor Details

    • InstructionDescriptor

      public InstructionDescriptor(IInstruction instruction, int linePosition)
      Creates an instance of InstructionDescriptor for a specific instruction.
      Parameters:
      instruction - instruction to provide context for
      linePosition - zero-based line position associated with the instruction
      Throws:
      IllegalArgumentException - if instruction is null or if linePosition is not a positive integer
  • Method Details

    • getInstruction

      public IInstruction getInstruction()
      Returns the instruction this descriptor provides the additional context for.
      Returns:
      instruction
    • getLinePosition

      public int getLinePosition()
      Returns the zero-based line position associated with the instruction.
      Returns:
      zero-based line position