Class WaveletTree
java.lang.Object
com.compomics.util.experiment.identification.protein_inference.fm_index.WaveletTree
- All Implemented Interfaces:
Serializable
public class WaveletTree extends Object implements Serializable
Wavelet tree.
- Author:
- Dominik Kopczynski
- See Also:
- Serialized Form
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
WaveletTree.HuffmanNode
Class for huffman nodes. -
Constructor Summary
Constructors Constructor Description WaveletTree()
Empty default constructor.WaveletTree(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler)
Constructor.WaveletTree(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
Constructor. -
Method Summary
Modifier and Type Method Description int[]
createLessTable()
Create the less table.void
createWaveletTreeHuffman(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
Create wavelet tree huffman.int
getAllocatedBytes()
Returns the number of bytes for the allocated arrays.int[]
getCharacterInfo(int index)
Returns the character and rank at a given index.int
getLength()
int
getRank(int index, int character)
Returns the number of occurrences of a given character until position index.int
getRankRecursive(int index, int character)
Returns the number of occurrences of a given character until position index.ArrayList<int[]>
rangeQuery(int leftIndex, int rightIndex)
Returns a list of character and new left/right index for a given range.void
rangeQuery(int leftIndex, int rightIndex, ArrayList<int[]> setCharacter)
Fills a list of character and new left/right index for a given range.void
rangeQueryOneValue(int index, ArrayList<int[]> setCharacter)
Fills a list of character and new left/right index for a given index.int
select(int occurrence, int character)
Inverse function to the rank function: given the i'th occurrence of a character in the tree, it provides its positionint[]
singleRangeQuery(int leftIndex, int rightIndex, int character)
Returns a new left/right index range for a given character recursively.
-
Constructor Details
-
WaveletTree
public WaveletTree()Empty default constructor. -
WaveletTree
Constructor.- Parameters:
text
- the textaAlphabet
- the alphabetwaitingHandler
- the waiting handler
-
WaveletTree
Constructor.- Parameters:
text
- the textwaitingHandler
- the waiting handlerroot
- the root
-
-
Method Details
-
getLength
public int getLength() -
createWaveletTreeHuffman
public void createWaveletTreeHuffman(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)Create wavelet tree huffman.- Parameters:
text
- the textwaitingHandler
- the waiting handlerroot
- the root
-
createLessTable
public int[] createLessTable()Create the less table.- Returns:
- the less table
-
getRank
public int getRank(int index, int character)Returns the number of occurrences of a given character until position index.- Parameters:
index
- the indexcharacter
- the character- Returns:
- the rank
-
getRankRecursive
public int getRankRecursive(int index, int character)Returns the number of occurrences of a given character until position index.- Parameters:
index
- the indexcharacter
- the character- Returns:
- the rank
-
getCharacterInfo
public int[] getCharacterInfo(int index)Returns the character and rank at a given index.- Parameters:
index
- the index- Returns:
- the character and rank
-
getAllocatedBytes
public int getAllocatedBytes()Returns the number of bytes for the allocated arrays.- Returns:
- number of allocated bytes
-
rangeQuery
Returns a list of character and new left/right index for a given range.- Parameters:
leftIndex
- left index boundaryrightIndex
- right index boundary- Returns:
- list of counted characters
-
rangeQuery
Fills a list of character and new left/right index for a given range.- Parameters:
leftIndex
- left index boundaryrightIndex
- right index boundarysetCharacter
- list of counted characters
-
rangeQueryOneValue
Fills a list of character and new left/right index for a given index.- Parameters:
index
- index boundarysetCharacter
- list of counted characters
-
singleRangeQuery
public int[] singleRangeQuery(int leftIndex, int rightIndex, int character)Returns a new left/right index range for a given character recursively.- Parameters:
leftIndex
- left index boundaryrightIndex
- right index boundarycharacter
- character to check- Returns:
- a list of character and new left/right index for a given range
-
select
public int select(int occurrence, int character)Inverse function to the rank function: given the i'th occurrence of a character in the tree, it provides its position- Parameters:
occurrence
- the i'th occurrencecharacter
- the character to check- Returns:
- the position of the i'th occurrence of the character
-