public class WaveletTree extends Object
Modifier and Type | Class and Description |
---|---|
class |
WaveletTree.HuffmanNode
Class for huffman nodes.
|
Constructor and Description |
---|
WaveletTree(byte[] text,
long[] aAlphabet,
WaitingHandler waitingHandler,
int numMasses)
Constructor.
|
WaveletTree(byte[] text,
long[] aAlphabet,
WaitingHandler waitingHandler,
int numMasses,
boolean hasPTMatTerminus)
Constructor.
|
WaveletTree(byte[] text,
WaitingHandler waitingHandler,
WaveletTree.HuffmanNode root,
int numMasses,
boolean hasPTMatTerminus)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
int[] |
createLessTable()
Create the less table.
|
void |
createWaveletTreeHuffman(byte[] text,
WaitingHandler waitingHandler,
WaveletTree.HuffmanNode root,
int numMasses,
boolean hasPTMatTerminus)
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 |
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.
|
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,
int[][] setCharacter)
Fills a list of character and new left/right index for a given range.
|
void |
rangeQueryOneValue(int index,
int[][] setCharacter)
Fills a list of character and new left/right index for a given index.
|
int[] |
singleRangeQuery(int leftIndex,
int rightIndex,
int character)
Returns a new left/right index range for a given character
recursively.
|
public WaveletTree(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler, int numMasses, boolean hasPTMatTerminus)
text
- the textaAlphabet
- the alphabetwaitingHandler
- the waiting handlernumMasses
- number of masses plus modificationshasPTMatTerminus
- indicates how to handle / signpublic WaveletTree(byte[] text, long[] aAlphabet, WaitingHandler waitingHandler, int numMasses)
text
- the textaAlphabet
- the alphabetwaitingHandler
- the waiting handlernumMasses
- number of masses plus modificationspublic WaveletTree(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root, int numMasses, boolean hasPTMatTerminus)
text
- the textwaitingHandler
- the waiting handlerroot
- the rootnumMasses
- number of masses plus modificationshasPTMatTerminus
- if there is a PTM at the terminuspublic void createWaveletTreeHuffman(byte[] text, WaitingHandler waitingHandler, WaveletTree.HuffmanNode root, int numMasses, boolean hasPTMatTerminus)
text
- the textwaitingHandler
- the waiting handlerroot
- the rootnumMasses
- number of masses plus modificationshasPTMatTerminus
- if there is a PTM at the terminuspublic 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 int[][] rangeQuery(int leftIndex, int rightIndex)
leftIndex
- left index boundaryrightIndex
- right index boundarypublic void rangeQuery(int leftIndex, int rightIndex, int[][] setCharacter)
leftIndex
- left index boundaryrightIndex
- right index boundarysetCharacter
- list of counted characterspublic void rangeQueryOneValue(int index, 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 checkCopyright © 2019. All rights reserved.