PageRenderTime 41ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre3/org/gjt/sp/jedit/search/SearchMatcher.java

#
Java | 53 lines | 8 code | 4 blank | 41 comment | 0 complexity | cfcc177d1439dd3358a834e2eb4d4da6 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. * Copyright (C) 1999, 2001 Slava Pestov
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version 2
  8. * of the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  18. */
  19. package org.gjt.sp.jedit.search;
  20. import gnu.regexp.CharIndexed;
  21. import javax.swing.text.Segment;
  22. /**
  23. * An abstract interface for matching strings.
  24. * @author Slava Pestov
  25. * @version $Id: SearchMatcher.java 3933 2001-12-03 10:52:27Z spestov $
  26. */
  27. public interface SearchMatcher
  28. {
  29. /**
  30. * Returns the offset of the first match of the specified text
  31. * within this matcher.
  32. * @param text The text to search in
  33. * @param start True if the start of the segment is the beginning of the
  34. * buffer
  35. * @param end True if the end of the segment is the end of the buffer
  36. * @return an array where the first element is the start offset
  37. * of the match, and the second element is the end offset of
  38. * the match
  39. * @since jEdit 4.0pre3
  40. */
  41. int[] nextMatch(CharIndexed text, boolean start, boolean end);
  42. /**
  43. * Returns the specified text, with any substitution specified
  44. * within this matcher performed.
  45. * @param text The text
  46. * @return The changed string
  47. */
  48. String substitute(String text) throws Exception;
  49. }