public class WaveletTree extends Object implements Serializable
Modifier and Type | Class and Description |
---|---|
class |
WaveletTree.HuffmanNode
Class for huffman nodes.
|
Constructor and Description |
---|
WaveletTree()
Empty default constructor.
|
WaveletTree(byte[] text,
long[] aAlphabet,
WaitingHandler waitingHandler)
Constructor.
|
WaveletTree(byte[] text,
WaitingHandler waitingHandler,
WaveletTree.HuffmanNode root)
Constructor.
|
Modifier and Type | Method and 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 position
|
int[] |
singleRangeQuery(int leftIndex,
int rightIndex,
int character)
Returns a new left/right index range for a given character recursively.
|
public WaveletTree()
public WaveletTree(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler)
text
- the textaAlphabet
- the alphabetwaitingHandler
- the waiting handlerpublic WaveletTree(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
text
- the textwaitingHandler
- the waiting handlerroot
- the rootpublic int getLength()
public void createWaveletTreeHuffman(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root)
text
- the textwaitingHandler
- the waiting handlerroot
- the rootpublic int[] createLessTable()
public int getRank(int index, int character)
index
- the indexcharacter
- the characterpublic int getRankRecursive(int index, int character)
index
- the indexcharacter
- the characterpublic int[] getCharacterInfo(int index)
index
- the indexpublic int getAllocatedBytes()
public ArrayList<int[]> rangeQuery(int leftIndex, int rightIndex)
leftIndex
- left index boundaryrightIndex
- right index boundarypublic void rangeQuery(int leftIndex, int rightIndex, ArrayList<int[]> setCharacter)
leftIndex
- left index boundaryrightIndex
- right index boundarysetCharacter
- list of counted characterspublic void rangeQueryOneValue(int index, ArrayList<int[]> setCharacter)
index
- index boundarysetCharacter
- list of counted characterspublic int[] singleRangeQuery(int leftIndex, int rightIndex, int character)
leftIndex
- left index boundaryrightIndex
- right index boundarycharacter
- character to checkpublic int select(int occurrence, int character)
occurrence
- the i'th occurrencecharacter
- the character to checkCopyright © 2021. All rights reserved.