Class IntegerArgument.IntegerParser<C>

  • All Implemented Interfaces:
    ArgumentParser<C,​java.lang.Integer>
    Enclosing class:
    IntegerArgument<C>

    public static final class IntegerArgument.IntegerParser<C>
    extends java.lang.Object
    implements ArgumentParser<C,​java.lang.Integer>
    • Constructor Summary

      Constructors 
      Constructor Description
      IntegerParser​(int min, int max)
      Construct a new integer parser
    • Method Summary

      Modifier and Type Method Description
      int getMax()
      Get the maximum value accepted by this parser
      int getMin()
      Get the minimum value accepted by this parser
      static @NonNull java.util.List<@NonNull java.lang.String> getSuggestions​(long min, long max, @NonNull java.lang.String input)
      Get integer suggestions.
      boolean isContextFree()
      Check whether or not this argument parser is context free.
      @NonNull ArgumentParseResult<java.lang.Integer> parse​(@NonNull CommandContext<C> commandContext, @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
      Parse command input into a command result
      @NonNull java.util.List<@NonNull java.lang.String> suggestions​(@NonNull CommandContext<C> commandContext, @NonNull java.lang.String input)
      Get a list of suggested arguments that would be correctly parsed by this parser
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • IntegerParser

        public IntegerParser​(int min,
                             int max)
        Construct a new integer parser
        Parameters:
        min - Minimum acceptable value
        max - Maximum acceptable value
    • Method Detail

      • getSuggestions

        public static @NonNull java.util.List<@NonNull java.lang.String> getSuggestions​(long min,
                                                                                        long max,
                                                                                        @NonNull java.lang.String input)
        Get integer suggestions. This supports both positive and negative numbers
        Parameters:
        min - Minimum value
        max - Maximum value
        input - Input
        Returns:
        List of suggestions
      • parse

        public @NonNull ArgumentParseResult<java.lang.Integer> parse​(@NonNull CommandContext<C> commandContext,
                                                                     @NonNull java.util.Queue<@NonNull java.lang.String> inputQueue)
        Description copied from interface: ArgumentParser
        Parse command input into a command result
        Specified by:
        parse in interface ArgumentParser<C,​java.lang.Integer>
        Parameters:
        commandContext - Command context
        inputQueue - The queue of arguments
        Returns:
        Parsed command result
      • getMin

        public int getMin()
        Get the minimum value accepted by this parser
        Returns:
        Min value
      • getMax

        public int getMax()
        Get the maximum value accepted by this parser
        Returns:
        Max value
      • isContextFree

        public boolean isContextFree()
        Description copied from interface: ArgumentParser
        Check whether or not this argument parser is context free. A context free parser will not use the provided command context, and so supports impromptu parsing
        Specified by:
        isContextFree in interface ArgumentParser<C,​java.lang.Integer>
        Returns:
        true if the parser is context free, else false
      • suggestions

        public @NonNull java.util.List<@NonNull java.lang.String> suggestions​(@NonNull CommandContext<C> commandContext,
                                                                              @NonNull java.lang.String input)
        Description copied from interface: ArgumentParser
        Get a list of suggested arguments that would be correctly parsed by this parser
        Specified by:
        suggestions in interface ArgumentParser<C,​java.lang.Integer>
        Parameters:
        commandContext - Command context
        input - Input string
        Returns:
        List of suggestions