Class CLOController
Object
CLOController
Encapsulates command line option setup, preprocessing, and parsing for
EvoLudo.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringCached command-line string that should be applied when parsing.final CLOptionCommand line option to set the delay between subsequent updates.final CLOptionCommand line option to print help message for available command line options.final CLOptionCommand line option to set the type of model (seeModelType).final CLOptionCommand line option to set module.final CLOptionCommand line option to request that the EvoLudo model immediately starts running after loading.final CLOptionCommand line option to set seed of random number generator.final CLOptionCommand line option to set the color for trajectories.final CLOptionCommand line option to set verbosity level of logging.private final EvoLudoOwning EvoLudo engine coordinating models and modules.final String[]Replacement command line option for serious parsing failures to display help screen.private final CLOParserParser used to manage all registered command-line options.private booleanFlag indicating whether the CLI string needs to be reparsed. -
Constructor Summary
ConstructorsConstructorDescriptionCLOController(EvoLudo evo) Create a controller bound to the supplied engine. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCLOProvider(CLOProvider provider) Register an additional source of command-line options.voidaddModuleKey(String key, String title) Notify controller that available module keys changed.voidcollectCLO(CLOParser prsr) Register all built-in CLOs with the supplied parser.private booleancontainsHelpOption(String[] cloarray) Check whether the--helpoption was provided.getCLO()Return the cached command-line string awaiting parsing.Build a help string summarizing all available options for the active module and model.Return the underlying parser used to register CLOs.Get the raw command-line string currently stored in the parser.String[]Return the cached command-line string split on option boundaries.private String[]handleModelOption(String[] cloarray, boolean helpRequested) Process the--modeloption, constraining choices based on the selected module.private String[]handleModuleOption(String[] cloarray, boolean helpRequested) Process the--moduleoption (loading modules early if needed).private String[]handleVerboseOption(String[] cloarray) Process the--verboseoption and update logger state.intparseCLO()Parse the cached command-line string.intParse the provided command-line arguments.intparsePreprocessedCLO(String[] cloarray) Parse arguments after preprocessing (quoting, substitutions) has completed.String[]preprocessCLO(String[] cloarray) Apply preprocessing to the command-line arguments (module/model resolution, helper options).booleanprovidesCLO(String name) Check whether this controller (or its providers) supplies the given option.voidremoveCLOProvider(CLOProvider provider) Remove a previously registered provider.voidRequest that the command-line string be reparsed before the next run.voidUpdate the cached command-line string to be parsed.
-
Field Details
-
engine
Owning EvoLudo engine coordinating models and modules. -
parser
Parser used to manage all registered command-line options. -
reparseCLO
private boolean reparseCLOFlag indicating whether the CLI string needs to be reparsed. -
clo
Cached command-line string that should be applied when parsing. -
cloModule
Command line option to set module. -
cloModel
-
cloSeed
Command line option to set seed of random number generator. -
cloRun
Command line option to request that the EvoLudo model immediately starts running after loading. -
cloDelay
Command line option to set the delay between subsequent updates. -
cloTrajectoryColor
-
cloVerbose
Command line option to set verbosity level of logging. -
cloHelp
Command line option to print help message for available command line options. -
helpCLO
Replacement command line option for serious parsing failures to display help screen.
-
-
Constructor Details
-
CLOController
Create a controller bound to the supplied engine.- Parameters:
evo- owning EvoLudo instance
-
-
Method Details
-
getParser
Return the underlying parser used to register CLOs.- Returns:
- the underlying parser used to register CLOs
-
getParserCLO
Get the raw command-line string currently stored in the parser.- Returns:
- the raw command-line string currently stored in the parser
-
providesCLO
Check whether this controller (or its providers) supplies the given option.- Parameters:
name- option name- Returns:
trueif provided
-
addCLOProvider
Register an additional source of command-line options.- Parameters:
provider- provider to add
-
removeCLOProvider
Remove a previously registered provider.- Parameters:
provider- provider to remove
-
requestParseCLO
public void requestParseCLO()Request that the command-line string be reparsed before the next run. -
getCLO
Return the cached command-line string awaiting parsing.- Returns:
- cached command-line string
-
setCLO
Update the cached command-line string to be parsed.- Parameters:
clo- command-line input
-
getSplitCLO
Return the cached command-line string split on option boundaries.- Returns:
- cached command-line string split on option boundaries
-
parseCLO
public int parseCLO()Parse the cached command-line string.- Returns:
- parser exit status
-
parseCLO
Parse the provided command-line arguments.- Parameters:
cloarray- arguments to parse- Returns:
- parser exit status
-
parsePreprocessedCLO
Parse arguments after preprocessing (quoting, substitutions) has completed.- Parameters:
cloarray- processed arguments- Returns:
- parser exit status
-
preprocessCLO
-
containsHelpOption
Check whether the--helpoption was provided.- Parameters:
cloarray- arguments to inspect- Returns:
trueif help was requested
-
handleModuleOption
-
handleModelOption
-
handleVerboseOption
-
getCLOHelp
Build a help string summarizing all available options for the active module and model.- Returns:
- formatted help text
-
collectCLO
Register all built-in CLOs with the supplied parser.- Parameters:
prsr- parser to populate
-
addModuleKey
-