Class FuzzyResult

java.lang.Object
org.aesh.readline.fuzzy.FuzzyResult

public final class FuzzyResult extends Object
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

    Fields
    Modifier and Type
    Field
    Description
    final int
    End index of the matched region in the input (exclusive).
    static final FuzzyResult
    No match found.
    final int[]
    Positions of each matched character in the input.
    final int
    Match score.
    final int
    Start index of the matched region in the input (inclusive).
  • Constructor Summary

    Constructors
    Constructor
    Description
    FuzzyResult(int start, int end, int score, int[] positions)
    Create a new fuzzy match result.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Returns true if this result represents a match.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NO_MATCH

      public static final FuzzyResult NO_MATCH
      No match found.
    • start

      public final int start
      Start index of the matched region in the input (inclusive).
    • end

      public final int end
      End index of the matched region in the input (exclusive).
    • score

      public final int score
      Match score. Higher is better. 0 or negative means no match.
    • positions

      public final int[] positions
      Positions 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 match
      end - end index of the matched region (exclusive), or -1 if no match
      score - 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:
      true if the start index is non-negative, indicating a match was found