Class ProgramSegment

java.lang.Object
svm.segment.Segment
svm.segment.ProgramSegment

public final class ProgramSegment extends Segment

Program Segment.

Link to GitHub: Source File.

Author:
Øystein Myhre Andersen
  • Field Details

    • instructions

      public Vector<SVM_Instruction> instructions
      The set of instructions in this ProgramSegment.
    • lastListed

      private int lastListed
      Listing utility: index to the last listed instruction.
  • Constructor Details

    • ProgramSegment

      public ProgramSegment(String ident)
      ProgramSegment constructor.
      Parameters:
      ident - the ProgramSegment ident
  • Method Details

    • nextAddress

      public ProgramAddress nextAddress()
      Returns the next ProgramAddress
      Returns:
      the next ProgramAddress
    • emit

      public void emit(SVM_Instruction instr)
      Emit an instruction by adding it to this ProgramSegment.
      Parameters:
      instr - instr to be added
    • listInstructions

      public void listInstructions()
      Listing utility: list all instructions not yet listed.
    • listIntruction

      public void listIntruction(String indent, int idx)
      Listing utility: List an instruction
      Parameters:
      indent - indentation String
      idx - index to the instruction
    • dump

      public void dump(String title)
      Description copied from class: Segment
      Utility: Segment dump
      Specified by:
      dump in class Segment
      Parameters:
      title - the printout title
    • dump

      public void dump(String title, int from, int to)
      Description copied from class: Segment
      Utility: Segment dump
      Specified by:
      dump in class Segment
      Parameters:
      title - the printout title
      from - Segment index
      to - Segment index
    • toString

      public String toString()
      Overrides:
      toString in class Segment
    • write

      public void write(AttributeOutputStream oupt) throws IOException
      Description copied from class: Segment
      Writes a Segment to the given output.
      Overrides:
      write in class Segment
      Parameters:
      oupt - the output stream
      Throws:
      IOException - if IOException occur
    • readObject

      public static ProgramSegment readObject(AttributeInputStream inpt) throws IOException
      Returns a ProgramSegment read from the given AttributeInputStream
      Parameters:
      inpt - the AttributeInputStream
      Returns:
      a ProgramSegment read from the given AttributeInputStream
      Throws:
      IOException - if IOException occur