Class ArgumentCompleter.ArgumentLine

  • All Implemented Interfaces:
    ParsedLine
    Enclosing class:
    ArgumentCompleter

    public static class ArgumentCompleter.ArgumentLine
    extends java.lang.Object
    implements ParsedLine
    A simple implementation of ParsedLine for argument completion.

    This class represents a single word with a cursor position, used for completing arguments in the ArgumentCompleter.

    • Constructor Summary

      Constructors 
      Constructor Description
      ArgumentLine​(java.lang.String word, int cursor)
      Creates a new ArgumentLine with the specified word and cursor position.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int cursor()
      The cursor position within the line.
      java.lang.String line()
      The unparsed line.
      java.lang.String word()
      The current word being completed.
      int wordCursor()
      The cursor position within the current word.
      int wordIndex()
      The index of the current word in the list of words.
      java.util.List<java.lang.String> words()
      The list of words.
      • Methods inherited from class java.lang.Object

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

      • ArgumentLine

        public ArgumentLine​(java.lang.String word,
                            int cursor)
        Creates a new ArgumentLine with the specified word and cursor position.
        Parameters:
        word - the word being completed
        cursor - the cursor position within the word
    • Method Detail

      • word

        public java.lang.String word()
        Description copied from interface: ParsedLine
        The current word being completed. If the cursor is after the last word, an empty string is returned.
        Specified by:
        word in interface ParsedLine
        Returns:
        the word being completed or an empty string
      • wordCursor

        public int wordCursor()
        Description copied from interface: ParsedLine
        The cursor position within the current word.
        Specified by:
        wordCursor in interface ParsedLine
        Returns:
        the cursor position within the current word
      • wordIndex

        public int wordIndex()
        Description copied from interface: ParsedLine
        The index of the current word in the list of words.
        Specified by:
        wordIndex in interface ParsedLine
        Returns:
        the index of the current word in the list of words
      • words

        public java.util.List<java.lang.String> words()
        Description copied from interface: ParsedLine
        The list of words.
        Specified by:
        words in interface ParsedLine
        Returns:
        the list of words
      • line

        public java.lang.String line()
        Description copied from interface: ParsedLine
        The unparsed line.
        Specified by:
        line in interface ParsedLine
        Returns:
        the unparsed line
      • cursor

        public int cursor()
        Description copied from interface: ParsedLine
        The cursor position within the line.
        Specified by:
        cursor in interface ParsedLine
        Returns:
        the cursor position within the line