org.gjt.sp.jedit.search

## Class SearchMatcher

- java.lang.Object
- - org.gjt.sp.jedit.search.SearchMatcher

- Direct Known Subclasses:
    BoyerMooreSearchMatcher, PatternSearchMatcher

      public abstract class SearchMatcher
      extends java.lang.Object

  An abstract class for matching strings.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SearchMatcher.Match`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.String` | `noWordSep` This should contains the noWordSep property of the edit mode of your buffer.
    `protected SearchMatcher.Match` | `returnValue`
    `protected boolean` | `wholeWord` true if this SearchMatcher search for whole words only.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchMatcher()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected boolean` | `isWholeWord(java.lang.CharSequence text, int start, int end)` Check if the result is a whole word
    `abstract SearchMatcher.Match` | `nextMatch(java.lang.CharSequence text, boolean start, boolean end, boolean firstTime, boolean reverse)` Returns the offset of the first match of the specified text within this matcher.
    `void` | `setNoWordSep(java.lang.String noWordSep)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### returnValue

          protected SearchMatcher.Match returnValue

    - #### wholeWord

          protected boolean wholeWord

      true if this SearchMatcher search for whole words only.

    - #### noWordSep

          protected java.lang.String noWordSep

      This should contains the noWordSep property of the edit mode of your buffer. It contains a list of chars that should be considered as word chars

  - ### Constructor Detail

    - #### SearchMatcher

          public SearchMatcher()

  - ### Method Detail

    - #### nextMatch

          public abstract SearchMatcher.Match nextMatch(java.lang.CharSequence text,
                                                        boolean start,
                                                        boolean end,
                                                        boolean firstTime,
                                                        boolean reverse)
                                                 throws java.lang.InterruptedException

      Returns the offset of the first match of the specified text within this matcher.
      Parameters:
        `text` - The text to search in
        `start` - True if the start of the text is the beginning of a line
        `end` - True if the end of the text is the end of a line
        `firstTime` - If false and the search string matched at the start offset with length zero, automatically find next match
        `reverse` - If true, searching will be performed in a backward direction.
      Returns:
        A `SearchMatcher.Match` object.
      Throws:
        `java.lang.InterruptedException`
      Since:
        jEdit 4.3pre5

    - #### setNoWordSep

          public void setNoWordSep(java.lang.String noWordSep)

      Parameters:
        `noWordSep` - the chars that are considered as word chars for this search
      Since:
        jEdit 4.5pre1

    - #### isWholeWord

          protected boolean isWholeWord(java.lang.CharSequence text,
                                        int start,
                                        int end)

      Check if the result is a whole word
      Parameters:
        `text` - the full text search
        `start` - the start match
        `end` - the end match
      Returns:
        true if the word is a whole word