Class SeparatorSuggestionGenerator<T>

Type Parameters:
T - the type of the available choices
All Implemented Interfaces:
Function<String, List<List<SubString>>>

public class SeparatorSuggestionGenerator<T> extends AbstractSegmentedSuggestionGenerator<T>
suggestion generator function for strings composed of separated strings.
Useful for number matching in choices like XXX-YYY-Z-AAA.
  • Constructor Details

    • SeparatorSuggestionGenerator

      public SeparatorSuggestionGenerator(String separator)
      Creates an suggestion generator for a given separator.
      Parameters:
      separator - the separator string
  • Method Details

    • isCaseSensitive

      public boolean isCaseSensitive()
      Returns whether comparison is case-sensitive.
      Returns:
      true if case-sensitive, false if not (default)
    • setCaseSensitive

      public void setCaseSensitive(boolean caseSensitive)
      Sets case sensitivity.
      Parameters:
      caseSensitive - true if case-sensitive, false if not (default)
    • match

      protected SubString match(SubString inputSegment, SubString itemSegment)
      Description copied from class: AbstractSegmentedSuggestionGenerator
      Determines the matching segment between an input- and item-segment.
      Specified by:
      match in class AbstractSegmentedSuggestionGenerator<T>
      Parameters:
      inputSegment - the input segment
      itemSegment - the item segment
      Returns:
      the matching segment, null if none
    • extractSegments

      protected List<SubString> extractSegments(String text)
      Extracts the separated segments from a string.
      Specified by:
      extractSegments in class AbstractSegmentedSuggestionGenerator<T>
      Parameters:
      text - the string
      Returns:
      the segments