Package org.jline.reader.impl
Class CompletionMatcherImpl
- java.lang.Object
-
- org.jline.reader.impl.CompletionMatcherImpl
-
- All Implemented Interfaces:
CompletionMatcher
public class CompletionMatcherImpl extends java.lang.Object implements CompletionMatcher
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.function.Predicate<java.lang.String>
exact
protected java.util.List<java.util.function.Function<java.util.Map<java.lang.String,java.util.List<Candidate>>,java.util.Map<java.lang.String,java.util.List<Candidate>>>>
matchers
-
Constructor Summary
Constructors Constructor Description CompletionMatcherImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean
camelMatch(java.lang.String word, int i, java.lang.String candidate, int j)
void
compile(java.util.Map<LineReader.Option,java.lang.Boolean> options, boolean prefix, CompletingParsedLine line, boolean caseInsensitive, int errors, java.lang.String originalGroupName)
Compiles completion matcher functionsprotected void
defaultMatchers(java.util.Map<LineReader.Option,java.lang.Boolean> options, boolean prefix, CompletingParsedLine line, boolean caseInsensitive, int errors, java.lang.String originalGroupName)
Default JLine matchersCandidate
exactMatch()
java.lang.String
getCommonPrefix()
java.util.List<Candidate>
matches(java.util.List<Candidate> candidates)
protected void
reset(boolean caseInsensitive)
protected java.util.function.Function<java.util.Map<java.lang.String,java.util.List<Candidate>>,java.util.Map<java.lang.String,java.util.List<Candidate>>>
simpleMatcher(java.util.function.Predicate<java.lang.String> predicate)
protected java.util.function.Function<java.util.Map<java.lang.String,java.util.List<Candidate>>,java.util.Map<java.lang.String,java.util.List<Candidate>>>
typoMatcher(java.lang.String word, int errors, boolean caseInsensitive, java.lang.String originalGroupName)
-
-
-
Method Detail
-
reset
protected void reset(boolean caseInsensitive)
-
compile
public void compile(java.util.Map<LineReader.Option,java.lang.Boolean> options, boolean prefix, CompletingParsedLine line, boolean caseInsensitive, int errors, java.lang.String originalGroupName)
Description copied from interface:CompletionMatcher
Compiles completion matcher functions- Specified by:
compile
in interfaceCompletionMatcher
- Parameters:
options
- LineReader optionsprefix
- invoked by complete-prefix or expand-or-complete-prefix widgetline
- The parsed line within which completion has been requestedcaseInsensitive
- if completion is case insensitive or noterrors
- number of errors accepted in matchingoriginalGroupName
- value of JLineReader variable original-group-name
-
matches
public java.util.List<Candidate> matches(java.util.List<Candidate> candidates)
- Specified by:
matches
in interfaceCompletionMatcher
- Parameters:
candidates
- list of candidates- Returns:
- a list of candidates that completion matcher matches
-
exactMatch
public Candidate exactMatch()
- Specified by:
exactMatch
in interfaceCompletionMatcher
- Returns:
- a candidate that have exact match, null if no exact match found
-
getCommonPrefix
public java.lang.String getCommonPrefix()
- Specified by:
getCommonPrefix
in interfaceCompletionMatcher
- Returns:
- a common prefix of matched candidates
-
defaultMatchers
protected void defaultMatchers(java.util.Map<LineReader.Option,java.lang.Boolean> options, boolean prefix, CompletingParsedLine line, boolean caseInsensitive, int errors, java.lang.String originalGroupName)
Default JLine matchers
-
simpleMatcher
protected java.util.function.Function<java.util.Map<java.lang.String,java.util.List<Candidate>>,java.util.Map<java.lang.String,java.util.List<Candidate>>> simpleMatcher(java.util.function.Predicate<java.lang.String> predicate)
-
typoMatcher
protected java.util.function.Function<java.util.Map<java.lang.String,java.util.List<Candidate>>,java.util.Map<java.lang.String,java.util.List<Candidate>>> typoMatcher(java.lang.String word, int errors, boolean caseInsensitive, java.lang.String originalGroupName)
-
camelMatch
protected boolean camelMatch(java.lang.String word, int i, java.lang.String candidate, int j)
-
-