Class ArgumentNumber<T extends Number>
java.lang.Object
io.github.mqzn.commands.arguments.AbstractArgument<T>
io.github.mqzn.commands.arguments.ArgumentNumber<T>
- All Implemented Interfaces:
Argument<T>
- Direct Known Subclasses:
ArgumentDouble
,ArgumentFloat
,ArgumentInteger
,ArgumentLong
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Comparator<T>
protected boolean
protected boolean
protected T
protected T
protected final BiFunction<String,
Integer, T> Fields inherited from class io.github.mqzn.commands.arguments.AbstractArgument
suggestions
-
Method Summary
Modifier and TypeMethodDescription@NotNull ArgumentNumber<T>
getMax()
Gets the maximum value for this argument.getMin()
Gets the minimum value for this argument.protected int
boolean
hasMax()
Gets if the argument has a maximum.boolean
hasMin()
Gets if the argument has a minimum.abstract T
@NotNull ArgumentNumber<T>
@NotNull ArgumentNumber<T>
protected @NotNull String
parseValue
(@NotNull String value) protected @Nullable String
removeScientificNotation
(@NotNull String value) Methods inherited from class io.github.mqzn.commands.arguments.AbstractArgument
asOptional, defaultValue, description, description, equals, hashCode, id, isOptional, setDefaultValue, setOptional, suggest, suggest, suggestions, toString, type, useRemainingSpace
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.github.mqzn.commands.arguments.Argument
alternativeTypes, isSuggestionDynamic
-
Field Details
-
radixParser
-
parser
-
comparator
-
hasMin
protected boolean hasMin -
hasMax
protected boolean hasMax -
min
-
max
-
-
Method Details
-
parse
@NotNull public T parse(@NotNull @NotNull String command, @NotNull @NotNull String input) throws ArgumentParseException - Throws:
ArgumentParseException
-
min
-
max
-
between
-
hasMin
public boolean hasMin()Gets if the argument has a minimum.- Returns:
- true if the argument has a minimum
-
getMin
Gets the minimum value for this argument.- Returns:
- the minimum of this argument
-
hasMax
public boolean hasMax()Gets if the argument has a maximum.- Returns:
- true if the argument has a maximum
-
getMax
Gets the maximum value for this argument.- Returns:
- the maximum of this argument
-
parseValue
-
getRadix
-
removeScientificNotation
-
increment
-