Package com.j3d.engine.interact.cmd.args
Class ArgSet
java.lang.Object
com.j3d.engine.interact.cmd.args.ArgSet
- All Implemented Interfaces:
Argument
A special type of string argument that can take a set of predefined string values.
Useful for commands that have options or modes.
ArgSets typically are in the form of [value1|value2|value3] in string form,
however that form may also be used to define subcommands who take in the exact same
amount and type of parameters.
- Author:
- Lehlogonolo Poole
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the values that this arg set allows.Provides a user-friendly description of what the argument does.getName()Returns the name of the argument.booleanSpecifies whether the argument is optional or required for the command to execute.booleanChecks whether a given value is valid for this arg set.
-
Field Details
-
allowedValues
-
name
-
description
-
isOptional
private final boolean isOptional
-
-
Constructor Details
-
ArgSet
Constructor for arg set- Parameters:
name- The name of the argumentdescription- The description of the argumentisOptional- Whether the argument is optionalallowedValues- The allowed values for the argument
-
-
Method Details
-
getAllowedValues
Retrieves the values that this arg set allows.- Returns:
- The allowed values for the argument
-
isValid
Checks whether a given value is valid for this arg set.- Parameters:
value- The value to check- Returns:
- True if the value is valid, false otherwise
-
getName
Description copied from interface:ArgumentReturns the name of the argument.This is the identifier used by the command parser to refer to this argument.
-
getDescription
Description copied from interface:ArgumentProvides a user-friendly description of what the argument does.This is typically used for generating help text or tooltips.
- Specified by:
getDescriptionin interfaceArgument- Returns:
- A brief description of the argument's purpose.
-
isOptional
public boolean isOptional()Description copied from interface:ArgumentSpecifies whether the argument is optional or required for the command to execute.- Specified by:
isOptionalin interfaceArgument- Returns:
trueif the argument is optional,falseif it is required.
-
toUseString
-