Package cs350s22.component.ui.parser
Class MetaParser
java.lang.Object
cs350s22.component.ui.parser.MetaParser
- All Implemented Interfaces:
SubParser
Meta commands are responsible for configuring and manipulating the architecture
itself, not the network it is executing.
-
Field Summary
Modifier and TypeFieldDescriptionprivate final String[]
private final int
private final cs350s22.component.ui.parser.A_ParserHelper
-
Constructor Summary
ConstructorDescriptionMetaParser
(String[] args, cs350s22.component.ui.parser.A_ParserHelper parserHelper) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Defines where the output goes for logging and reporting.private void
Prints the current time to standard output.private void
exit()
Exits the system.void
parse()
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
setClockState
(String arg) 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.
-
Field Details
-
args
-
parserHelper
private final cs350s22.component.ui.parser.A_ParserHelper parserHelper -
numOfCmdArgs
private final int numOfCmdArgs
-
-
Constructor Details
-
MetaParser
Constructor.
-
-
Method Details
-
parse
Description copied from interface:SubParser
Method each sub parser is required to use to begin parsing their respective commands.- Specified by:
parse
in interfaceSubParser
- Throws:
IOException
- Invalid input.
-
setClockHelper
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
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
Defines where the output goes for logging and reporting. This must be the first command issued.- Throws:
IOException
- Invalid input.
-