Class ArgumentList
java.lang.Object
com.github.alex1304.ultimategdbot.api.command.ArgumentList
public class ArgumentList
extends java.lang.Object
Represents the list of the arguments of a command.
-
Constructor Summary
Constructors Constructor Description ArgumentList(java.util.List<java.lang.String> tokens)
-
Method Summary
Modifier and Type Method Description java.lang.String
get(int position)
Returns the argument at the specified position.java.lang.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).java.util.List<java.lang.String>
getTokens()
java.util.List<java.lang.String>
getTokens(int maxCount)
int
tokenCount()
Gets the number of tokens (arguments) present in the list.java.lang.String
toString()
-
Constructor Details
-
ArgumentList
public ArgumentList(java.util.List<java.lang.String> tokens)
-
-
Method Details
-
tokenCount
public int tokenCount()Gets the number of tokens (arguments) present in the list.- Returns:
- the token count
-
get
public java.lang.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:
java.lang.IndexOutOfBoundsException
- if the position is out of bounds
-
getAllAfter
public java.lang.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
-
getTokens
public java.util.List<java.lang.String> getTokens() -
getTokens
public java.util.List<java.lang.String> getTokens(int maxCount) -
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-