Package org.teiid.internal.core.index
Class IndexInput
- java.lang.Object
-
- org.teiid.internal.core.index.IndexInput
-
- Direct Known Subclasses:
BlocksIndexInput
public abstract class IndexInput extends Object
This class provides an input on an index, after it has been generated. You can access all the files of an index via getNextFile(), getCurrentFile() and moveToNextFile() (idem for the word entries). The usage is the same for every subclass: creation (constructor), opening (the open() method), usage, and closing (the close() method), to release the data source used by this input.
-
-
Field Summary
Fields Modifier and Type Field Description protected WordEntrycurrentWordEntryprotected intfilePositionprotected intwordPosition
-
Constructor Summary
Constructors Constructor Description IndexInput()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidclearCache()clears the cache of this indexInput, if it keeps track of the information already read.abstract voidclose()Closes the IndexInput.abstract IndexedFilegetCurrentFile()Returns the current file the indexInput is pointing to in the index.WordEntrygetCurrentWordEntry()Returns the current file the indexInput is pointing to in the index.intgetFilePosition()Returns the position of the current file the input is pointing to in the index.abstract IndexedFilegetIndexedFile(int fileNum)Returns the indexedFile corresponding to the given document number in the index the input reads in, or null if such indexedFile does not exist.abstract IndexedFilegetIndexedFile(IDocument document)Returns the indexedFile corresponding to the given document in the index the input reads in (e.g.abstract intgetNumFiles()Returns the number of files in the index.abstract intgetNumWords()Returns the number of unique words in the index.abstract ObjectgetSource()Returns the Object the input is reading from.booleanhasMoreFiles()Returns true if the input has not reached the end of the index for the files.booleanhasMoreWords()Returns true if the input has not reached the end of the index for the files.booleanisOpen()returns the open state of the indexabstract voidmoveToNextFile()Moves the pointer on the current file to the next file in the index.abstract voidmoveToNextWordEntry()Moves the pointer on the current word to the next file in the index.abstract voidopen()Open the Source where the input gets the information from.abstract IEntryResult[]queryEntriesPrefixedBy(char[] prefix)Returns the list of the files containing the given word in the index.abstract IQueryResult[]queryFilesReferringToPrefix(char[] prefix)abstract IQueryResult[]queryInDocumentNames(String word)Returns the list of the files whose name contain the given word in the index.protected abstract voidsetFirstFile()Set the pointer on the current file to the first file of the index.protected abstract voidsetFirstWord()Set the pointer on the current word to the first word of the index.voidsetOpen(boolean state)Set the open state of the Index
-
-
-
Field Detail
-
filePosition
protected int filePosition
-
currentWordEntry
protected WordEntry currentWordEntry
-
wordPosition
protected int wordPosition
-
-
Method Detail
-
clearCache
public abstract void clearCache()
clears the cache of this indexInput, if it keeps track of the information already read.
-
close
public abstract void close() throws IOExceptionCloses the IndexInput. For example, if the input is on a RandomAccessFile, it calls the close() method of RandomAccessFile.- Throws:
IOException
-
getCurrentFile
public abstract IndexedFile getCurrentFile() throws IOException
Returns the current file the indexInput is pointing to in the index.- Throws:
IOException
-
getCurrentWordEntry
public WordEntry getCurrentWordEntry() throws IOException
Returns the current file the indexInput is pointing to in the index.- Throws:
IOException
-
getFilePosition
public int getFilePosition()
Returns the position of the current file the input is pointing to in the index.
-
setOpen
public void setOpen(boolean state)
Set the open state of the Index- Since:
- 5.0
-
isOpen
public boolean isOpen()
returns the open state of the index- Since:
- 5.0
-
getIndexedFile
public abstract IndexedFile getIndexedFile(int fileNum) throws IOException
Returns the indexedFile corresponding to the given document number in the index the input reads in, or null if such indexedFile does not exist.- Throws:
IOException
-
getIndexedFile
public abstract IndexedFile getIndexedFile(IDocument document) throws IOException
Returns the indexedFile corresponding to the given document in the index the input reads in (e.g. the indexedFile with the same path in this index), or null if such indexedFile does not exist.- Throws:
IOException
-
getNumFiles
public abstract int getNumFiles()
Returns the number of files in the index.
-
getNumWords
public abstract int getNumWords()
Returns the number of unique words in the index.
-
getSource
public abstract Object getSource()
Returns the Object the input is reading from. It can be an IIndex, a File, ...
-
hasMoreFiles
public boolean hasMoreFiles()
Returns true if the input has not reached the end of the index for the files.
-
hasMoreWords
public boolean hasMoreWords()
Returns true if the input has not reached the end of the index for the files.
-
moveToNextFile
public abstract void moveToNextFile() throws IOExceptionMoves the pointer on the current file to the next file in the index.- Throws:
IOException
-
moveToNextWordEntry
public abstract void moveToNextWordEntry() throws IOExceptionMoves the pointer on the current word to the next file in the index.- Throws:
IOException
-
open
public abstract void open() throws IOExceptionOpen the Source where the input gets the information from.- Throws:
IOException
-
queryEntriesPrefixedBy
public abstract IEntryResult[] queryEntriesPrefixedBy(char[] prefix) throws IOException
Returns the list of the files containing the given word in the index.- Throws:
IOException
-
queryFilesReferringToPrefix
public abstract IQueryResult[] queryFilesReferringToPrefix(char[] prefix) throws IOException
- Throws:
IOException
-
queryInDocumentNames
public abstract IQueryResult[] queryInDocumentNames(String word) throws IOException
Returns the list of the files whose name contain the given word in the index.- Throws:
IOException
-
setFirstFile
protected abstract void setFirstFile() throws IOExceptionSet the pointer on the current file to the first file of the index.- Throws:
IOException
-
setFirstWord
protected abstract void setFirstWord() throws IOExceptionSet the pointer on the current word to the first word of the index.- Throws:
IOException
-
-