PageRenderTime 60ms CodeModel.GetById 57ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
Java | 56 lines | 9 code | 4 blank | 43 comment | 0 complexity | 5974421ef6d9303210c146a53bda55d2 MD5 | raw file
 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
20package org.gjt.sp.jedit.search;
21
22import gnu.regexp.CharIndexed;
23import javax.swing.text.Segment;
24
25/**
26 * An abstract interface for matching strings.
27 * @author Slava Pestov
28 * @version $Id: SearchMatcher.java 4089 2002-03-15 04:11:37Z spestov $
29 */
30public interface SearchMatcher
31{
32	/**
33	 * Returns the offset of the first match of the specified text
34	 * within this matcher.
35	 * @param text The text to search in
36	 * @param start True if the start of the segment is the beginning of the
37	 * buffer
38	 * @param end True if the end of the segment is the end of the buffer
39	 * @param firstTime If false and the search string matched at the start
40	 * offset with length zero, automatically find next match
41	 * @return an array where the first element is the start offset
42	 * of the match, and the second element is the end offset of
43	 * the match
44	 * @since jEdit 4.0pre3
45	 */
46	int[] nextMatch(CharIndexed text, boolean start, boolean end,
47		boolean firstTime);
48
49	/**
50	 * Returns the specified text, with any substitution specified
51	 * within this matcher performed.
52	 * @param text The text
53	 * @return The changed string
54	 */
55	String substitute(String text) throws Exception;
56}