Class Completer

java.lang.Object
com.marcpg.libpg.text.Completer

public class Completer extends Object
Used for autocompletion, suggestions and search.
Since:
0.0.1
  • Method Details

    • startComplete

      public static List<String> startComplete(String input, @NotNull @NotNull Collection<String> suggested)
      Filter suggestions based on what was already typed.
      If suggested has "max", "cat", "thomas" and "mouse" in it,
      input = "c" would suggest "cat"
      input = "m" would suggest "mouse" and "max"
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      See Also:
    • startComplete

      public static List<String> startComplete(String input, String[] suggested)
      Filter suggestions based on what was already typed.
      If suggested has "max", "cat", "thomas" and "mouse" in it,
      input = "c" would suggest "cat"
      input = "m" would suggest "mouse" and "max"
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      See Also:
    • containComplete

      public static List<String> containComplete(String input, @NotNull @NotNull Collection<String> suggested)
      Filter suggestions based on what was already typed.
      If suggested has "max", "cat", "thomas" and "mouse" in it,
      input = "c" would suggest "cat"
      input = "m" would suggest "mouse", "max" and "thomas"
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      See Also:
    • containComplete

      public static List<String> containComplete(String input, String[] suggested)
      Filter suggestions based on what was already typed.
      If suggested has "max", "cat", "thomas" and "mouse" in it,
      input = "c" would suggest "cat"
      input = "m" would suggest "mouse", "max" and "thomas"
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      See Also:
    • semiSmartComplete

      public static List<String> semiSmartComplete(@NotNull @NotNull String input, Collection<String> suggested)
      Filter suggestions based on what was already typed.
      Combines startComplete(String, Collection) and containComplete(String, Collection).
      If the length of the input is three characters or less, it will use start completion and if the input is over three characters long, it will use contain completion.
      This ensures that the amount of suggested strings is limited and doesn't reach too high numbers.
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      Since:
      0.0.2
      See Also:
    • semiSmartComplete

      public static List<String> semiSmartComplete(@NotNull @NotNull String input, String[] suggested)
      Filter suggestions based on what was already typed.
      Combines startComplete(String, String[]) and containComplete(String, String[]).
      If the length of the input is three characters or less, it will use start completion and if the input is over three characters long, it will use contain completion.
      This ensures that the amount of suggested strings is limited and doesn't reach too high numbers.
      Parameters:
      input - What was already typed
      suggested - All things that can be suggested
      Returns:
      A list of filtered suggestions based on input and suggested
      Since:
      0.0.2
      See Also: