|
| 1 | +/* |
| 2 | + * Copyright (c) 2002-2020, the original author or authors. |
| 3 | + * |
| 4 | + * This software is distributable under the BSD license. See the terms of the |
| 5 | + * BSD license in the documentation provided with this software. |
| 6 | + * |
| 7 | + * https://opensource.org/licenses/BSD-3-Clause |
| 8 | + */ |
| 9 | +package jdk.internal.org.jline.reader; |
| 10 | + |
| 11 | +import java.util.List; |
| 12 | +import java.util.Map; |
| 13 | + |
| 14 | +public interface CompletionMatcher { |
| 15 | + |
| 16 | + /** |
| 17 | + * Compiles completion matcher functions |
| 18 | + * |
| 19 | + * @param options LineReader options |
| 20 | + * @param prefix invoked by complete-prefix or expand-or-complete-prefix widget |
| 21 | + * @param line The parsed line within which completion has been requested |
| 22 | + * @param caseInsensitive if completion is case insensitive or not |
| 23 | + * @param errors number of errors accepted in matching |
| 24 | + * @param originalGroupName value of JLineReader variable original-group-name |
| 25 | + */ |
| 26 | + void compile(Map<LineReader.Option, Boolean> options, boolean prefix, CompletingParsedLine line |
| 27 | + , boolean caseInsensitive, int errors, String originalGroupName); |
| 28 | + |
| 29 | + /** |
| 30 | + * |
| 31 | + * @param candidates list of candidates |
| 32 | + * @return a map of candidates that completion matcher matches |
| 33 | + */ |
| 34 | + List<Candidate> matches(List<Candidate> candidates); |
| 35 | + |
| 36 | + /** |
| 37 | + * |
| 38 | + * @return a candidate that have exact match, null if no exact match found |
| 39 | + */ |
| 40 | + Candidate exactMatch(); |
| 41 | + |
| 42 | + /** |
| 43 | + * |
| 44 | + * @return a common prefix of matched candidates |
| 45 | + */ |
| 46 | + String getCommonPrefix(); |
| 47 | + |
| 48 | +} |
0 commit comments