Class WaveletTree
java.lang.Object
com.compomics.util.experiment.identification.protein_inference.fm_index.WaveletTree
- All Implemented Interfaces:
Serializable
Wavelet tree.
- Author:
- Dominik Kopczynski
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionEmpty default constructor.WaveletTree(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler) Constructor.WaveletTree(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint[]Create the less table.voidcreateWaveletTreeHuffman(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root) Create wavelet tree huffman.intReturns the number of bytes for the allocated arrays.int[]getCharacterInfo(int index) Returns the character and rank at a given index.intintgetRank(int index, int character) Returns the number of occurrences of a given character until position index.intgetRankRecursive(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.voidrangeQuery(int leftIndex, int rightIndex, ArrayList<int[]> setCharacter) Fills a list of character and new left/right index for a given range.voidrangeQueryOneValue(int index, ArrayList<int[]> setCharacter) Fills a list of character and new left/right index for a given index.intselect(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
-