Class AbstractSearchable.SearchResult

  • Enclosing class:
    AbstractSearchable

    public static class AbstractSearchable.SearchResult
    extends java.lang.Object
    A convenience class to hold search state.

    NOTE: this is still in-flow, probably will take more responsibility/ or even change altogether on further factoring

    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) int foundColumn  
      (package private) int foundRow  
      (package private) java.util.regex.MatchResult matchResult  
      (package private) java.util.regex.Pattern pattern  
    • Constructor Summary

      Constructors 
      Constructor Description
      SearchResult()
      Instantiates an empty SearchResult.
      SearchResult​(java.util.regex.Pattern ex, java.util.regex.MatchResult result, int row, int column)
      Instantiates a SearchResult with the given state.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getFoundColumn()
      Returns the column index of the match position.
      int getFoundRow()
      Returns the row index of the match position.
      java.util.regex.MatchResult getMatchResult()
      Returns the MatchResult representing the current match.
      java.util.regex.Pattern getPattern()
      Returns the Pattern used for matching.
      java.lang.String getRegEx()
      Returns the regex of the Pattern used for matching.
      void reset()
      Resets all internal state to no-match.
      void resetFoundColumn()
      Resets the column to OFF.
      void updateFrom​(AbstractSearchable.SearchResult searchResult)
      Sets internal state to the same as the given SearchResult.
      • Methods inherited from class java.lang.Object

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

      • foundRow

        int foundRow
      • foundColumn

        int foundColumn
      • matchResult

        java.util.regex.MatchResult matchResult
      • pattern

        java.util.regex.Pattern pattern
    • Constructor Detail

      • SearchResult

        public SearchResult()
        Instantiates an empty SearchResult.
      • SearchResult

        public SearchResult​(java.util.regex.Pattern ex,
                            java.util.regex.MatchResult result,
                            int row,
                            int column)
        Instantiates a SearchResult with the given state.
        Parameters:
        ex - the Pattern used for matching
        result - the current MatchResult
        row - the row index of the current match
        column - the column index of the current match
    • Method Detail

      • updateFrom

        public void updateFrom​(AbstractSearchable.SearchResult searchResult)
        Sets internal state to the same as the given SearchResult. Resets internals if the param is null.
        Parameters:
        searchResult - the SearchResult to copy internal state from.
      • getRegEx

        public java.lang.String getRegEx()
        Returns the regex of the Pattern used for matching.
        Returns:
        the regex of the Pattern used for matching.
      • reset

        public void reset()
        Resets all internal state to no-match.
      • resetFoundColumn

        public void resetFoundColumn()
        Resets the column to OFF.
      • getFoundColumn

        public int getFoundColumn()
        Returns the column index of the match position.
        Returns:
        the column index of the match position.
      • getFoundRow

        public int getFoundRow()
        Returns the row index of the match position.
        Returns:
        the row index of the match position.
      • getMatchResult

        public java.util.regex.MatchResult getMatchResult()
        Returns the MatchResult representing the current match.
        Returns:
        the MatchResult representing the current match.
      • getPattern

        public java.util.regex.Pattern getPattern()
        Returns the Pattern used for matching.
        Returns:
        the Pattern used for the matching.