Class MetaParser

java.lang.Object
cs350s22.component.ui.parser.MetaParser
All Implemented Interfaces:
SubParser

public class MetaParser extends Object implements SubParser
Meta commands are responsible for configuring and manipulating the architecture itself, not the network it is executing.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final String[]
     
    private final int
     
    private final cs350s22.component.ui.parser.A_ParserHelper
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    MetaParser(String[] args, cs350s22.component.ui.parser.A_ParserHelper parserHelper)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    private void
    Defines where the output goes for logging and reporting.
    private void
    Prints the current time to standard output.
    private void
    Exits the system.
    void
    Method each sub parser is required to use to begin parsing their respective commands.
    private void
    run()
    Loads and runs the script in fully qualified filename string.
    private void
    Parses @CLOCK sub commands, and execute their respective methods.
    private void
    Updates the clock manually one time.
    private void
    setClockOneStep(int oneStep)
    Updates the clock 'count' times.
    private void
    setClockRate(int value)
    Sets the clock rate value in milliseconds per update.
    private void
    Pauses or resumes automated updating by the clock.
    private void
    setClockWaitFor(double value)
    Waits for value seconds before processing the next command.
    private void
    setClockWaitUntil(double value)
    Waits until time is at least value seconds before processing the next command.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • args

      private final String[] args
    • parserHelper

      private final cs350s22.component.ui.parser.A_ParserHelper parserHelper
    • numOfCmdArgs

      private final int numOfCmdArgs
  • Constructor Details

    • MetaParser

      public MetaParser(String[] args, cs350s22.component.ui.parser.A_ParserHelper parserHelper)
      Constructor.
  • Method Details

    • parse

      public void parse() throws IOException
      Description copied from interface: SubParser
      Method each sub parser is required to use to begin parsing their respective commands.
      Specified by:
      parse in interface SubParser
      Throws:
      IOException - Invalid input.
    • setClockHelper

      private void setClockHelper() throws IOException
      Parses @CLOCK sub commands, and execute their respective methods.
      Throws:
      IOException - Invalid input.
    • displayClock

      private void displayClock()
      Prints the current time to standard output.
    • setClockState

      private void setClockState(String arg)
      Pauses or resumes automated updating by the clock.
      Parameters:
      arg - The state the clock should be set to.
    • setClockOneStep

      private void setClockOneStep()
      Updates the clock manually one time. This is valid only while the clock is paused.
    • setClockOneStep

      private void setClockOneStep(int oneStep)
      Updates the clock 'count' times. This is valid only while the clock is paused.
      Parameters:
      oneStep - The amount to update the clock by.
    • setClockRate

      private void setClockRate(int value)
      Sets the clock rate value in milliseconds per update.
      Parameters:
      value - The rate for which the clock should be set to.
    • setClockWaitFor

      private void setClockWaitFor(double value)
      Waits for value seconds before processing the next command.
      Parameters:
      value - The number of seconds to wait for.
    • setClockWaitUntil

      private void setClockWaitUntil(double value)
      Waits until time is at least value seconds before processing the next command.
      Parameters:
      value - Seconds to wait till the time reaches.
    • exit

      private void exit()
      Exits the system. This must be the last statement; otherwise, log files may not be complete.
    • run

      private void run()
      Loads and runs the script in fully qualified filename string.
    • configure

      private void configure() throws IOException
      Defines where the output goes for logging and reporting. This must be the first command issued.
      Throws:
      IOException - Invalid input.