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