Class AutoCompletion

java.lang.Object
gda.jython.completion.AutoCompletion
All Implemented Interfaces:
Serializable

public class AutoCompletion extends Object implements Serializable
Container for possible text completions

Provides strings before and after that are the parts of the original line that should remain either side of the cursor.

options is a list of AutoCompleteOptions that are possible completions of the original string.

The final line should be
>>> <before>|<chosen completion><after>
See Also:
  • Constructor Details

  • Method Details

    • noCompletions

      public static AutoCompletion noCompletions(String line, int posn)
      Return the an empty AutoCompletion from a line and position
      Parameters:
      line - Current line
      posn - Position of cursor in current line
      Returns:
      An AutoCompletion as if there were no completions available
    • getOptions

      public Collection<AutoCompleteOption> getOptions()
    • getStrings

      public Collection<String> getStrings()
      Returns:
      List of strings that could replace the current string section
    • getPosition

      public int getPosition()
      Returns:
      Cursor position that completion should be inserted a
      This should be before.length()
    • getBefore

      public String getBefore()
      The line up to the point where the completion is being inserted.
      This is not always the cursor position where the completion was requested
      Returns:
      line up to completion position
    • getAfter

      public String getAfter()
      The text from the original line that was after the cursor position and should not be replaced by the completion
      Returns:
      String to be added after the completion
    • toString

      public String toString()
      Overrides:
      toString in class Object