PageRenderTime 56ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/org/gjt/sp/jedit/search/SearchMatcher.java

#
Java | 67 lines | 18 code | 6 blank | 43 comment | 0 complexity | fe48293fd8dc7573a70b5d6add31b349 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  1. /*
  2. * SearchMatcher.java - Abstract string matcher interface
  3. * :tabSize=8:indentSize=8:noTabs=false:
  4. * :folding=explicit:collapseFolds=1:
  5. *
  6. * Copyright (C) 1999, 2001, 2002 Slava Pestov
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License
  10. * as published by the Free Software Foundation; either version 2
  11. * of the License, or any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program; if not, write to the Free Software
  20. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. */
  22. package org.gjt.sp.jedit.search;
  23. import gnu.regexp.CharIndexed;
  24. /**
  25. * An abstract class for matching strings.
  26. * @author Slava Pestov
  27. * @version $Id: SearchMatcher.java 4826 2003-07-14 23:00:54Z spestov $
  28. */
  29. public abstract class SearchMatcher
  30. {
  31. public SearchMatcher()
  32. {
  33. returnValue = new Match();
  34. }
  35. /**
  36. * Returns the offset of the first match of the specified text
  37. * within this matcher.
  38. * @param text The text to search in
  39. * @param start True if the start of the segment is the beginning of the
  40. * buffer
  41. * @param end True if the end of the segment is the end of the buffer
  42. * @param firstTime If false and the search string matched at the start
  43. * offset with length zero, automatically find next match
  44. * @param reverse If true, searching will be performed in a backward
  45. * direction.
  46. * @return an array where the first element is the start offset
  47. * of the match, and the second element is the end offset of
  48. * the match
  49. * @since jEdit 4.2pre4
  50. */
  51. public abstract Match nextMatch(CharIndexed text, boolean start,
  52. boolean end, boolean firstTime, boolean reverse);
  53. protected Match returnValue;
  54. //{{{ Match class
  55. public static class Match
  56. {
  57. public int start;
  58. public int end;
  59. public String[] substitutions;
  60. } //}}}
  61. }