pandalib-util javadoc and small API changes

This commit is contained in:
2022-07-28 01:13:35 +02:00
parent 5ff9a40f19
commit f7dc774dbd
27 changed files with 1585 additions and 1841 deletions

View File

@@ -190,12 +190,12 @@ public interface SuggestionsSupplier<S> {
static <S> SuggestionsSupplier<S> suggestDuration() {
final List<String> emptyTokenSuggestions = TimeUtil.DURATION_SUFFIXES.stream().map(p -> "1" + p).collect(Collectors.toList());
final List<String> emptyTokenSuggestions = DURATION_SUFFIXES.stream().map(p -> "1" + p).collect(Collectors.toList());
return (s, ti, token, args) -> {
if (token.isEmpty()) {
return emptyTokenSuggestions;
}
List<String> remainingSuffixes = new ArrayList<>(TimeUtil.DURATION_SUFFIXES);
List<String> remainingSuffixes = new ArrayList<>(DURATION_SUFFIXES);
char[] tokenChars = token.toCharArray();
String accSuffix = "";
for (char c : tokenChars) {
@@ -215,6 +215,11 @@ public interface SuggestionsSupplier<S> {
};
}
/**
* List of all possible duration unit symbols for suggestions.
*/
public static final List<String> DURATION_SUFFIXES = List.of("y", "mo", "w", "d", "h", "m", "s");
private static void scanAndRemovePastSuffixes(List<String> suffixes, String foundSuffix) {
for (int i = 0; i < suffixes.size(); i++) {