PageRenderTime 30ms CodeModel.GetById 9ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/org/gjt/sp/jedit/search/SearchMatcher.java

#
Java | 65 lines | 17 code | 5 blank | 43 comment | 0 complexity | 6c52b76c192fe20b86f51220a3320542 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. /**
  24. * An abstract class for matching strings.
  25. * @author Slava Pestov
  26. * @version $Id: SearchMatcher.java 5443 2006-06-18 18:51:40Z vanza $
  27. */
  28. public abstract class SearchMatcher
  29. {
  30. public SearchMatcher()
  31. {
  32. returnValue = new Match();
  33. }
  34. /**
  35. * Returns the offset of the first match of the specified text
  36. * within this matcher.
  37. * @param text The text to search in
  38. * @param start True if the start of the segment is the beginning of the
  39. * buffer
  40. * @param end True if the end of the segment is the end of the buffer
  41. * @param firstTime If false and the search string matched at the start
  42. * offset with length zero, automatically find next match
  43. * @param reverse If true, searching will be performed in a backward
  44. * direction.
  45. * @return an array where the first element is the start offset
  46. * of the match, and the second element is the end offset of
  47. * the match
  48. * @since jEdit 4.3pre5
  49. */
  50. public abstract Match nextMatch(CharSequence text, boolean start,
  51. boolean end, boolean firstTime, boolean reverse);
  52. protected Match returnValue;
  53. //{{{ Match class
  54. public static class Match
  55. {
  56. public int start;
  57. public int end;
  58. public String[] substitutions;
  59. } //}}}
  60. }