Package org.teiid.internal.core.index
Class IndexSummary
- java.lang.Object
-
- org.teiid.internal.core.index.IndexSummary
-
public class IndexSummary extends Object
An indexSummary is used when saving an index into a BlocksIndexOuput or reading it from a BlocksIndexInput. It contains basic informations about an index: first files/words in each block, number of files/words.
-
-
Field Summary
Fields Modifier and Type Field Description protected ArrayList
firstFilesInBlocks
First file for each block.protected boolean
firstWordAdded
protected int
firstWordBlockNum
protected ArrayList
firstWordsInBlocks
First word for each block.protected int
numFiles
Number of files in the index.protected int
numWords
Number of words in the index.
-
Constructor Summary
Constructors Constructor Description IndexSummary()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFirstFileInBlock(IndexedFile indexedFile, int blockNum)
Adds the given file as the first file for the given Block number.void
addFirstWordInBlock(char[] word, int blockNum)
Adds the given word as the first word for the given Block number.int[]
getAllBlockNums()
Returns the numbers of all the blocksint
getBlockNum(int blockLocation)
int
getBlockNumForFileNum(int fileNum)
Returns the number of the Block containing the file with the given number.int
getBlockNumForWord(char[] word)
Returns the number of the Block containing the given word.int[]
getBlockNumsForPrefix(char[] prefix)
int
getFirstBlockLocationForPrefix(char[] prefix)
int
getFirstWordBlockNum()
Returns the number of the first IndexBlock (containing words).int
getNextBlockLocationForPrefix(char[] prefix, int blockLoc)
Blocks are contiguous, so the next one is a potential candidate if its first word starts with the given prefixint
getNumFiles()
Returns the number of files contained in the index.int
getNumWords()
Returns the number of words contained in the index.void
read(RandomAccessFile raf)
Loads the summary in memory.void
setNumFiles(int numFiles)
Sets the number of files of the index.void
setNumWords(int numWords)
Sets the number of words of the index.void
write(RandomAccessFile raf)
Saves the summary on the disk.
-
-
-
Field Detail
-
firstFilesInBlocks
protected ArrayList firstFilesInBlocks
First file for each block.
-
firstWordsInBlocks
protected ArrayList firstWordsInBlocks
First word for each block.
-
numFiles
protected int numFiles
Number of files in the index.
-
numWords
protected int numWords
Number of words in the index.
-
firstWordBlockNum
protected int firstWordBlockNum
-
firstWordAdded
protected boolean firstWordAdded
-
-
Method Detail
-
addFirstFileInBlock
public void addFirstFileInBlock(IndexedFile indexedFile, int blockNum)
Adds the given file as the first file for the given Block number.
-
addFirstWordInBlock
public void addFirstWordInBlock(char[] word, int blockNum)
Adds the given word as the first word for the given Block number.
-
getAllBlockNums
public int[] getAllBlockNums()
Returns the numbers of all the blocks
-
getBlockNum
public int getBlockNum(int blockLocation)
-
getBlockNumForFileNum
public int getBlockNumForFileNum(int fileNum)
Returns the number of the Block containing the file with the given number.
-
getBlockNumForWord
public int getBlockNumForWord(char[] word)
Returns the number of the Block containing the given word.
-
getBlockNumsForPrefix
public int[] getBlockNumsForPrefix(char[] prefix)
-
getFirstBlockLocationForPrefix
public int getFirstBlockLocationForPrefix(char[] prefix)
-
getFirstWordBlockNum
public int getFirstWordBlockNum()
Returns the number of the first IndexBlock (containing words).
-
getNextBlockLocationForPrefix
public int getNextBlockLocationForPrefix(char[] prefix, int blockLoc)
Blocks are contiguous, so the next one is a potential candidate if its first word starts with the given prefix
-
getNumFiles
public int getNumFiles()
Returns the number of files contained in the index.
-
getNumWords
public int getNumWords()
Returns the number of words contained in the index.
-
read
public void read(RandomAccessFile raf) throws IOException
Loads the summary in memory.- Throws:
IOException
-
setNumFiles
public void setNumFiles(int numFiles)
Sets the number of files of the index.
-
setNumWords
public void setNumWords(int numWords)
Sets the number of words of the index.
-
write
public void write(RandomAccessFile raf) throws IOException
Saves the summary on the disk.- Throws:
IOException
-
-