Class SelectionCommandParameter
java.lang.Object
org.tweetyproject.plugin.parameter.CommandParameter
org.tweetyproject.plugin.parameter.SelectionCommandParameter
- All Implemented Interfaces:
Cloneable
This class expands the CommandParameter with a selection-array containing
strings the parameter supports
- Author:
- Bastian Wolf
-
Constructor Summary
ConstructorsConstructorDescriptionSelectionCommandParameter(String id, String des) Creates a new parameter.SelectionCommandParameter(String id, String des, String[] selections) Creates a new parameter. -
Method Summary
Modifier and TypeMethodDescriptionclone()String[]returns each possible selection argumentgetValue()returns the given instantiation argument value for this parameterinstantiates a new parameter iff the given value ist valid for this command parameterInstantiates a list of `CommandParameter` objects based on the provided list of strings.booleanchecks whether a cli input parameter argument is valid for the called command parametervoidsetSelections(String[] selections) sets new selection parametervoidsets the instantiated parameter argument value, value has to be one of the options contained in selectionsMethods inherited from class org.tweetyproject.plugin.parameter.CommandParameter
getDescription, getIdentifier
-
Constructor Details
-
SelectionCommandParameter
-
SelectionCommandParameter
-
-
Method Details
-
getSelections
returns each possible selection argument- Returns:
- each possible selection argument
-
setSelections
sets new selection parameter- Parameters:
selections- an array of strings
-
getValue
returns the given instantiation argument value for this parameter- Returns:
- the given instantiation argument value for this parameter
-
setValue
sets the instantiated parameter argument value, value has to be one of the options contained in selections- Parameters:
value- the value given as argument value
-
isValid
checks whether a cli input parameter argument is valid for the called command parameter- Specified by:
isValidin classCommandParameter- Parameters:
s- the given input string- Returns:
- true if valid, false if not
-
instantiate
instantiates a new parameter iff the given value ist valid for this command parameter- Specified by:
instantiatein classCommandParameter- Parameters:
s- the given argument string- Returns:
- The CommandParameter instance or null if the given string is not valid.
-
instantiate
Instantiates a list of `CommandParameter` objects based on the provided list of strings.This method processes a list of string values, validates each one, and creates a corresponding `SelectionCommandParameter` for each valid string. The `SelectionCommandParameter` is created by cloning the current object and setting its value to the corresponding string from the input list. The created parameters are collected into an `ArrayList` and returned.
The method modifies the input list of strings by removing each processed and valid string.
- Parameters:
s- an `ArrayList` of `String` objects representing the input values to be converted into command parameters.- Returns:
- an `ArrayList` of `CommandParameter` objects, each instantiated from a valid string in the input list.
-
clone
-