PageRenderTime 68ms CodeModel.GetById 61ms app.highlight 2ms RepoModel.GetById 4ms 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
 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
23package org.gjt.sp.jedit.search;
24
25import gnu.regexp.CharIndexed;
26
27/**
28 * An abstract class for matching strings.
29 * @author Slava Pestov
30 * @version $Id: SearchMatcher.java 4826 2003-07-14 23:00:54Z spestov $
31 */
32public abstract class SearchMatcher
33{
34	public SearchMatcher()
35	{
36		returnValue = new Match();
37	}
38
39	/**
40	 * Returns the offset of the first match of the specified text
41	 * within this matcher.
42	 * @param text The text to search in
43	 * @param start True if the start of the segment is the beginning of the
44	 * buffer
45	 * @param end True if the end of the segment is the end of the buffer
46	 * @param firstTime If false and the search string matched at the start
47	 * offset with length zero, automatically find next match
48	 * @param reverse If true, searching will be performed in a backward
49	 * direction.
50	 * @return an array where the first element is the start offset
51	 * of the match, and the second element is the end offset of
52	 * the match
53	 * @since jEdit 4.2pre4
54	 */
55	public abstract Match nextMatch(CharIndexed text, boolean start,
56		boolean end, boolean firstTime, boolean reverse);
57
58	protected Match returnValue;
59
60	//{{{ Match class
61	public static class Match
62	{
63		public int start;
64		public int end;
65		public String[] substitutions;
66	} //}}}
67}