Class FuzzyResult
java.lang.Object
org.aesh.readline.fuzzy.FuzzyResult
Result of a fuzzy match operation.
Contains the score, the start/end indices of the matched substring within the input text, and optionally the positions of each matched character (for match highlighting).
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal intEnd index of the matched region in the input (exclusive).static final FuzzyResultNo match found.final int[]Positions of each matched character in the input.final intMatch score.final intStart index of the matched region in the input (inclusive). -
Constructor Summary
ConstructorsConstructorDescriptionFuzzyResult(int start, int end, int score, int[] positions) Create a new fuzzy match result. -
Method Summary
Modifier and TypeMethodDescriptionbooleanisMatch()Returns true if this result represents a match.
-
Field Details
-
NO_MATCH
No match found. -
start
public final int startStart index of the matched region in the input (inclusive). -
end
public final int endEnd index of the matched region in the input (exclusive). -
score
public final int scoreMatch score. Higher is better. 0 or negative means no match. -
positions
public final int[] positionsPositions of each matched character in the input. May be null if positions were not requested. When non-null,positions.length == pattern.length.
-
-
Constructor Details
-
FuzzyResult
public FuzzyResult(int start, int end, int score, int[] positions) Create a new fuzzy match result.- Parameters:
start- start index of the matched region (inclusive), or -1 if no matchend- end index of the matched region (exclusive), or -1 if no matchscore- the match score (higher is better)positions- positions of each matched character, or null if not requested
-
-
Method Details
-
isMatch
public boolean isMatch()Returns true if this result represents a match.- Returns:
trueif the start index is non-negative, indicating a match was found
-