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
FieldsModifier and TypeFieldDescriptionprivate final String[]private final intprivate final cs350s22.component.ui.parser.A_ParserHelper -
Constructor Summary
ConstructorsConstructorDescriptionMetaParser(String[] args, cs350s22.component.ui.parser.A_ParserHelper parserHelper) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidDefines where the output goes for logging and reporting.private voidPrints the current time to standard output.private voidexit()Exits the system.voidparse()Method each sub parser is required to use to begin parsing their respective commands.private voidrun()Loads and runs the script in fully qualified filename string.private voidParses @CLOCK sub commands, and execute their respective methods.private voidUpdates the clock manually one time.private voidsetClockOneStep(int oneStep) Updates the clock 'count' times.private voidsetClockRate(int value) Sets the clock rate value in milliseconds per update.private voidsetClockState(String arg) Pauses or resumes automated updating by the clock.private voidsetClockWaitFor(double value) Waits for value seconds before processing the next command.private voidsetClockWaitUntil(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:SubParserMethod each sub parser is required to use to begin parsing their respective commands.- Specified by:
parsein 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.
-