SimpleCompletor
Date: 2015-12-09

jline

## Class SimpleCompletor

- java.lang.Object
- - jline.SimpleCompletor

- All Implemented Interfaces:
    java.lang.Cloneable, Completor
  Direct Known Subclasses:
    ClassNameCompletor

      public class SimpleCompletor
      extends java.lang.Object
      implements Completor, java.lang.Cloneable

  A simple `Completor` implementation that handles a pre-defined list of completion words.

  Example usage:

        myConsoleReader.addCompletor (new SimpleCompletor (new String [] { "now", "yesterday", "tomorrow" }));

  Author:
    Marc Prud'hommeaux

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SimpleCompletor.NoOpFilter`
    `static interface` | `SimpleCompletor.SimpleCompletorFilter` Filter for elements in the completor.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SimpleCompletor(java.io.InputStream in)` Complete candidates using the whitespearated values in read from the specified Reader.
    `SimpleCompletor(java.io.Reader reader)` Complete candidates using the contents of the specified Reader.
    `SimpleCompletor(java.lang.String candidateString)` Create a new SimpleCompletor with a single possible completion values.
    `SimpleCompletor(java.lang.String[] candidateStrings)` Create a new SimpleCompletor with a list of possible completion values.
    `SimpleCompletor(java.lang.String[] strings, SimpleCompletor.SimpleCompletorFilter filter)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addCandidateString(java.lang.String candidateString)`
    `java.lang.Object` | `clone()`
    `int` | `complete(java.lang.String buffer, int cursor, java.util.List clist)` Populates candidates with a list of possible completions for the buffer.
    `java.util.SortedSet` | `getCandidates()`
    `java.lang.String` | `getDelimiter()`
    `void` | `setCandidates(java.util.SortedSet candidates)`
    `void` | `setCandidateStrings(java.lang.String[] strings)`
    `void` | `setDelimiter(java.lang.String delimiter)`

    - ### Methods inherited from class java.lang.Object

      `equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### SimpleCompletor

          public SimpleCompletor(java.lang.String candidateString)

      Create a new SimpleCompletor with a single possible completion values.

    - #### SimpleCompletor

          public SimpleCompletor(java.lang.String[] candidateStrings)

      Create a new SimpleCompletor with a list of possible completion values.

    - #### SimpleCompletor

          public SimpleCompletor(java.lang.String[] strings,
                         SimpleCompletor.SimpleCompletorFilter filter)

    - #### SimpleCompletor

          public SimpleCompletor(java.io.Reader reader)
                          throws java.io.IOException

      Complete candidates using the contents of the specified Reader.
      Throws:
        `java.io.IOException`

    - #### SimpleCompletor

          public SimpleCompletor(java.io.InputStream in)
                          throws java.io.IOException

      Complete candidates using the whitespearated values in read from the specified Reader.
      Throws:
        `java.io.IOException`

  - ### Method Detail

    - #### complete

          public int complete(java.lang.String buffer,
                     int cursor,
                     java.util.List clist)

      Description copied from interface: `Completor`
      Populates candidates with a list of possible completions for the buffer. The candidates list will not be sorted before being displayed to the user: thus, the complete method should sort the `List` before returning.
      Specified by:
        `complete` in interface `Completor`
      Parameters:
        `buffer` - the buffer
        `clist` - the `List` of candidates to populate
      Returns:
        the index of the buffer for which the completion will be relative

    - #### setDelimiter

          public void setDelimiter(java.lang.String delimiter)

    - #### getDelimiter

          public java.lang.String getDelimiter()

    - #### setCandidates

          public void setCandidates(java.util.SortedSet candidates)

    - #### getCandidates

          public java.util.SortedSet getCandidates()

    - #### setCandidateStrings

          public void setCandidateStrings(java.lang.String[] strings)

    - #### addCandidateString

          public void addCandidateString(java.lang.String candidateString)

    - #### clone

          public java.lang.Object clone()
                                 throws java.lang.CloneNotSupportedException

      Overrides:
        `clone` in class `java.lang.Object`
      Throws:
        `java.lang.CloneNotSupportedException`