Class ArgumentList
- java.lang.Object
-
- com.github.alex1304.ultimategdbot.api.command.ArgumentList
-
public class ArgumentList extends Object
Represents the list of the arguments of a command.
-
-
Constructor Summary
Constructors Constructor Description ArgumentList(List<String> tokens)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
get(int position)
Returns the argument at the specified position.String
getAllAfter(int position)
Gets all arguments from the specified position to the last one, into one String resulting of the concatenation of all arguments (separated with a whitespace).List<String>
getTokens()
List<String>
getTokens(int maxCount)
int
tokenCount()
Gets the number of tokens (arguments) present in the list.String
toString()
-
-
-
Method Detail
-
tokenCount
public int tokenCount()
Gets the number of tokens (arguments) present in the list.- Returns:
- the token count
-
get
public String get(int position)
Returns the argument at the specified position.- Parameters:
position
- the position of the argument- Returns:
- the argument at the specified position
- Throws:
IndexOutOfBoundsException
- if the position is out of bounds
-
getAllAfter
public String getAllAfter(int position)
Gets all arguments from the specified position to the last one, into one String resulting of the concatenation of all arguments (separated with a whitespace). Specifying a position <= 0 returns all arguments. Specifying a position >= tokenCount will result in an empty String.- Parameters:
position
- the position of the first arguments- Returns:
- all arguments into one concatenated String
-
-