Package org.eclipse.search.core.text
Class TextSearchMatchAccess
- java.lang.Object
-
- org.eclipse.search.core.text.TextSearchMatchAccess
-
public abstract class TextSearchMatchAccess extends Object
ATextSearchMatchAccess
gives access to a pattern match found by theTextSearchEngine
.Please note that
objects do not have value semantic. The state of the object might change over time especially since objects are reused for different call backs. Clients shall not keep a reference to aTextSearchMatchAccess
TextSearchMatchAccess
element.This class should only be implemented by implementors of a
TextSearchEngine
.- Since:
- 3.2
-
-
Constructor Summary
Constructors Constructor Description TextSearchMatchAccess()
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description abstract IFile
getFile()
Returns the file the match was found in.abstract String
getFileContent(int offset, int length)
Returns the file's content at the given offsets.abstract char
getFileContentChar(int offset)
Returns a character of the file's content at the given offsetabstract int
getFileContentLength()
Returns the length of this file's content.abstract int
getMatchLength()
Returns the length of this search match.abstract int
getMatchOffset()
Returns the offset of this search match.
-
-
-
Method Detail
-
getFile
public abstract IFile getFile()
Returns the file the match was found in.- Returns:
- the file the match was found.
-
getMatchOffset
public abstract int getMatchOffset()
Returns the offset of this search match.- Returns:
- the offset of this search match
-
getMatchLength
public abstract int getMatchLength()
Returns the length of this search match.- Returns:
- the length of this search match
-
getFileContentLength
public abstract int getFileContentLength()
Returns the length of this file's content.- Returns:
- the length of this file's content.
-
getFileContentChar
public abstract char getFileContentChar(int offset)
Returns a character of the file's content at the given offset- Parameters:
offset
- the offset- Returns:
- the character at the given offset
- Throws:
IndexOutOfBoundsException
- anIndexOutOfBoundsException
is thrown when theoffset
is negative or not less than the file content's length.
-
getFileContent
public abstract String getFileContent(int offset, int length)
Returns the file's content at the given offsets.- Parameters:
offset
- the offset of the requested contentlength
- the of the requested content- Returns:
- the substring of the file's content
- Throws:
IndexOutOfBoundsException
- anIndexOutOfBoundsException
is thrown when theoffset
or thelength
are negative or whenoffset + length
is not less than the file content's length.
-
-