org.teiid.internal.core.index
Class SimpleIndexInput

java.lang.Object
  extended by org.teiid.internal.core.index.IndexInput
      extended by org.teiid.internal.core.index.SimpleIndexInput

public class SimpleIndexInput
extends IndexInput

A simpleIndexInput is an input on an in memory Index.


Field Summary
protected  IndexedFile currentFile
           
protected  InMemoryIndex index
           
protected  IndexedFile[] sortedFiles
           
protected  WordEntry[] sortedWordEntries
           
 
Fields inherited from class org.teiid.internal.core.index.IndexInput
currentWordEntry, filePosition, wordPosition
 
Constructor Summary
SimpleIndexInput(InMemoryIndex index)
           
 
Method Summary
 void clearCache()
          clears the cache of this indexInput, if it keeps track of the information already read.
 void close()
          Closes the IndexInput.
 IndexedFile getCurrentFile()
          Returns the current file the indexInput is pointing to in the index.
 IndexedFile getIndexedFile(IDocument document)
          Returns the indexedFile corresponding to the given document in the index the input reads in (e.g.
 IndexedFile getIndexedFile(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.
 int getNumFiles()
          Returns the number of files in the index.
 int getNumWords()
          Returns the number of unique words in the index.
 java.lang.Object getSource()
          Returns the Object the input is reading from.
 void init()
           
 void moveToNextFile()
          Moves the pointer on the current file to the next file in the index.
 void moveToNextWordEntry()
          Moves the pointer on the current word to the next file in the index.
 void open()
          Open the Source where the input gets the information from.
 IEntryResult[] queryEntriesPrefixedBy(char[] prefix)
          Returns the list of the files containing the given word in the index.
 IQueryResult[] queryFilesReferringToPrefix(char[] prefix)
           
 IQueryResult[] queryInDocumentNames(java.lang.String word)
          Returns the list of the files whose name contain the given word in the index.
protected  void setFirstFile()
          Set the pointer on the current file to the first file of the index.
protected  void setFirstWord()
          Set the pointer on the current word to the first word of the index.
 
Methods inherited from class org.teiid.internal.core.index.IndexInput
getCurrentWordEntry, getFilePosition, hasMoreFiles, hasMoreWords, isOpen, setOpen
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sortedWordEntries

protected WordEntry[] sortedWordEntries

currentFile

protected IndexedFile currentFile

sortedFiles

protected IndexedFile[] sortedFiles

index

protected InMemoryIndex index
Constructor Detail

SimpleIndexInput

public SimpleIndexInput(InMemoryIndex index)
Method Detail

clearCache

public void clearCache()
Description copied from class: IndexInput
clears the cache of this indexInput, if it keeps track of the information already read.

Specified by:
clearCache in class IndexInput
See Also:
IndexInput.clearCache()

close

public void close()
           throws java.io.IOException
Description copied from class: IndexInput
Closes the IndexInput. For example, if the input is on a RandomAccessFile, it calls the close() method of RandomAccessFile.

Specified by:
close in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.close()

getCurrentFile

public IndexedFile getCurrentFile()
                           throws java.io.IOException
Description copied from class: IndexInput
Returns the current file the indexInput is pointing to in the index.

Specified by:
getCurrentFile in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.getCurrentFile()

getIndexedFile

public IndexedFile getIndexedFile(int fileNum)
                           throws java.io.IOException
Description copied from class: IndexInput
Returns the indexedFile corresponding to the given document number in the index the input reads in, or null if such indexedFile does not exist.

Specified by:
getIndexedFile in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.getIndexedFile(int)

getIndexedFile

public IndexedFile getIndexedFile(IDocument document)
                           throws java.io.IOException
Description copied from class: IndexInput
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.

Specified by:
getIndexedFile in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.getIndexedFile(IDocument)

getNumFiles

public int getNumFiles()
Description copied from class: IndexInput
Returns the number of files in the index.

Specified by:
getNumFiles in class IndexInput
See Also:
IndexInput.getNumFiles()

getNumWords

public int getNumWords()
Description copied from class: IndexInput
Returns the number of unique words in the index.

Specified by:
getNumWords in class IndexInput
See Also:
IndexInput.getNumWords()

getSource

public java.lang.Object getSource()
Description copied from class: IndexInput
Returns the Object the input is reading from. It can be an IIndex, a File, ...

Specified by:
getSource in class IndexInput
See Also:
IndexInput.getSource()

init

public void init()

moveToNextFile

public void moveToNextFile()
                    throws java.io.IOException
Description copied from class: IndexInput
Moves the pointer on the current file to the next file in the index.

Specified by:
moveToNextFile in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.moveToNextFile()

moveToNextWordEntry

public void moveToNextWordEntry()
                         throws java.io.IOException
Description copied from class: IndexInput
Moves the pointer on the current word to the next file in the index.

Specified by:
moveToNextWordEntry in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.moveToNextWordEntry()

open

public void open()
          throws java.io.IOException
Description copied from class: IndexInput
Open the Source where the input gets the information from.

Specified by:
open in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.open()

queryEntriesPrefixedBy

public IEntryResult[] queryEntriesPrefixedBy(char[] prefix)
                                      throws java.io.IOException
Description copied from class: IndexInput
Returns the list of the files containing the given word in the index.

Specified by:
queryEntriesPrefixedBy in class IndexInput
Throws:
java.io.IOException

queryFilesReferringToPrefix

public IQueryResult[] queryFilesReferringToPrefix(char[] prefix)
                                           throws java.io.IOException
Specified by:
queryFilesReferringToPrefix in class IndexInput
Throws:
java.io.IOException

queryInDocumentNames

public IQueryResult[] queryInDocumentNames(java.lang.String word)
                                    throws java.io.IOException
Description copied from class: IndexInput
Returns the list of the files whose name contain the given word in the index.

Specified by:
queryInDocumentNames in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.queryInDocumentNames(String)

setFirstFile

protected void setFirstFile()
                     throws java.io.IOException
Description copied from class: IndexInput
Set the pointer on the current file to the first file of the index.

Specified by:
setFirstFile in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.setFirstFile()

setFirstWord

protected void setFirstWord()
                     throws java.io.IOException
Description copied from class: IndexInput
Set the pointer on the current word to the first word of the index.

Specified by:
setFirstWord in class IndexInput
Throws:
java.io.IOException
See Also:
IndexInput.setFirstWord()


Copyright © 2011. All Rights Reserved.