Class Completers.RegexCompleter.ArgumentLine

  • All Implemented Interfaces:
    ParsedLine
    Enclosing class:
    Completers.RegexCompleter

    public static class Completers.RegexCompleter.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 RegexCompleter.

    • 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()
      Gets the cursor position within the line.
      java.lang.String line()
      Gets the full line, which is the same as the current word.
      java.lang.String word()
      Gets the current word.
      int wordCursor()
      Gets the cursor position within the current word.
      int wordIndex()
      Gets the index of the current word, which is always 0 for ArgumentLine.
      java.util.List<java.lang.String> words()
      Gets the list of words, which contains only the current word.
      • 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()
        Gets the current word.
        Specified by:
        word in interface ParsedLine
        Returns:
        the current word
      • wordCursor

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

        public int wordIndex()
        Gets the index of the current word, which is always 0 for ArgumentLine.
        Specified by:
        wordIndex in interface ParsedLine
        Returns:
        always returns 0
      • words

        public java.util.List<java.lang.String> words()
        Gets the list of words, which contains only the current word.
        Specified by:
        words in interface ParsedLine
        Returns:
        a singleton list containing the current word
      • line

        public java.lang.String line()
        Gets the full line, which is the same as the current word.
        Specified by:
        line in interface ParsedLine
        Returns:
        the current word
      • cursor

        public int cursor()
        Gets the cursor position within the line.
        Specified by:
        cursor in interface ParsedLine
        Returns:
        the cursor position