KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > search > core > text > TextSearchMatchAccess


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.search.core.text;
13
14 import org.eclipse.core.resources.IFile;
15
16 /**
17  * A {@link TextSearchMatchAccess} gives access to a pattern match found by the {@link TextSearchEngine}.
18  * <p>
19  * Please note that <code>{@link TextSearchMatchAccess}</code> objects <b>do not
20  * </b> have value semantic. The state of the object might change over
21  * time especially since objects are reused for different call backs. Clients shall not keep a reference to
22  * a {@link TextSearchMatchAccess} element.
23  * </p>
24  * <p>
25  * This class should only be implemented by implementors of a {@link TextSearchEngine}.
26  * </p>
27  * @since 3.2
28  */

29 public abstract class TextSearchMatchAccess {
30     
31     /**
32      * Returns the file the match was found in.
33      *
34      * @return the file the match was found.
35      */

36     public abstract IFile getFile();
37     
38     /**
39      * Returns the offset of this search match.
40      *
41      * @return the offset of this search match
42      */

43     public abstract int getMatchOffset();
44     
45     /**
46      * Returns the length of this search match.
47      *
48      * @return the length of this search match
49      */

50     public abstract int getMatchLength();
51     
52     /**
53      * Returns the length of this file's content.
54      *
55      * @return the length of this file's content.
56      */

57     public abstract int getFileContentLength();
58     
59     /**
60      * Returns a character of the file's content at the given offset
61      *
62      * @return the character at the given offset
63      * @throws IndexOutOfBoundsException an {@link IndexOutOfBoundsException} is
64      * thrown when the <code>offset</code> is negative or not less than the file content's length.
65      */

66     public abstract char getFileContentChar(int offset);
67     
68     /**
69      * Returns the file's content at the given offsets.
70      *
71      * @param offset the offset of the requested content
72      * @param length the of the requested content
73      * @return the substring of the file's content
74      * @throws IndexOutOfBoundsException an {@link IndexOutOfBoundsException} is
75      * thrown when the <code>offset</code> or the <code>length</code> are negative
76      * or when <code>offset + length</code> is not less than the file content's length.
77      */

78     public abstract String JavaDoc getFileContent(int offset, int length);
79
80 }
81
Popular Tags