org.eclipse.wst.jsdt.internal.core.index
Class Index
java.lang.Object
org.eclipse.wst.jsdt.internal.core.index.Index
public class Index
- extends java.lang.Object
An Index
maps document names to their referenced words in various categories.
Queries can search a single category or several at the same time.
Indexes are not synchronized structures and should only be queried/updated one at a time.
Field Summary |
java.lang.String |
containerPath
|
org.eclipse.wst.jsdt.internal.core.search.indexing.ReadWriteMonitor |
monitor
|
Constructor Summary |
Index(java.lang.String fileName,
java.lang.String containerPath,
boolean reuseExistingFile)
|
Method Summary |
void |
addIndexEntry(char[] category,
char[] key,
java.lang.String containerRelativePath)
|
java.lang.String |
containerRelativePath(java.lang.String documentPath)
|
java.io.File |
getIndexFile()
|
boolean |
hasChanged()
|
static boolean |
isMatch(char[] pattern,
char[] word,
int matchRule)
|
EntryResult[] |
query(char[][] categories,
char[] key,
int matchRule)
Returns the entries containing the given key in a group of categories, or null if no matches are found. |
java.lang.String[] |
queryDocumentNames(java.lang.String substring)
Returns the document names that contain the given substring, if null then returns all of them. |
void |
remove(java.lang.String containerRelativePath)
|
void |
save()
|
void |
startQuery()
|
void |
stopQuery()
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
containerPath
public java.lang.String containerPath
monitor
public org.eclipse.wst.jsdt.internal.core.search.indexing.ReadWriteMonitor monitor
Index
public Index(java.lang.String fileName,
java.lang.String containerPath,
boolean reuseExistingFile)
throws java.io.IOException
- Throws:
java.io.IOException
isMatch
public static boolean isMatch(char[] pattern,
char[] word,
int matchRule)
addIndexEntry
public void addIndexEntry(char[] category,
char[] key,
java.lang.String containerRelativePath)
containerRelativePath
public java.lang.String containerRelativePath(java.lang.String documentPath)
getIndexFile
public java.io.File getIndexFile()
hasChanged
public boolean hasChanged()
query
public EntryResult[] query(char[][] categories,
char[] key,
int matchRule)
throws java.io.IOException
- Returns the entries containing the given key in a group of categories, or null if no matches are found.
The matchRule dictates whether its an exact, prefix or pattern match, as well as case sensitive or insensitive.
If the key is null then all entries in specified categories are returned.
- Throws:
java.io.IOException
queryDocumentNames
public java.lang.String[] queryDocumentNames(java.lang.String substring)
throws java.io.IOException
- Returns the document names that contain the given substring, if null then returns all of them.
- Throws:
java.io.IOException
remove
public void remove(java.lang.String containerRelativePath)
save
public void save()
throws java.io.IOException
- Throws:
java.io.IOException
startQuery
public void startQuery()
stopQuery
public void stopQuery()
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object