public class DoubleArrayTrie extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
DoubleArrayTrie.Result |
| Constructor and Description |
|---|
DoubleArrayTrie() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
build(char[][] key,
int[] value)
Builds a double array trie.
|
List<DoubleArrayTrie.Result> |
commonPrefixSearch(CharSequence key)
Searches strings which are specified key's prefix.
|
List<DoubleArrayTrie.Result> |
commonPrefixSearch(CharSequence key,
int offset)
Searches strings which are specified key's prefix.
|
List<DoubleArrayTrie.Result> |
commonPrefixSearch(CharSequence key,
int offset,
int length)
Searches strings which are specified key's prefix.
|
List<DoubleArrayTrie.Result> |
commonPrefixSearch(CharSequence key,
int offset,
int length,
int nodePos)
Searches the value to which be associated with the specified key.
|
int |
exactMatchSearch(CharSequence key)
Searches the value to which be associated with the specified key.
|
int |
exactMatchSearch(CharSequence key,
int offset)
Searches the value to which be associated with the specified key.
|
int |
exactMatchSearch(CharSequence key,
int offset,
int length)
Searches the value to which be associated with the specified key.
|
int |
exactMatchSearch(CharSequence key,
int offset,
int length,
int nodePos)
Searches the value to which be associated with the specified key.
|
DoubleArrayTrie.Result |
getLongestCommonPrefix(CharSequence key)
Returns longest common prefix between strings in the trie and specified
key.
|
DoubleArrayTrie.Result |
getLongestCommonPrefix(CharSequence key,
int offset)
Returns longest common prefix between strings in the trie and specified
key.
|
DoubleArrayTrie.Result |
getLongestCommonPrefix(CharSequence key,
int offset,
int length)
Returns longest common prefix between strings in the trie and specified
key.
|
DoubleArrayTrie.Result |
getLongestCommonPrefix(CharSequence key,
int offset,
int length,
int nodePos)
Returns longest common prefix between strings in the trie and specified
key.
|
void |
load(File file)
Loads double array from file.
|
void |
load(String filename)
Loads double array from file.
|
void |
save(String filename)
Saves double array into file
|
public boolean build(char[][] key,
int[] value)
key - array of each wordvalue - array of each value.public void save(String filename) throws IOException
filename - the named of file to save double arrayIOException - if an I/O error occurspublic void load(String filename) throws IOException
filename - the system depended filenameIOException - if an I/O error occurspublic void load(File file) throws IOException
file - the file objectIOException - if an I/O error occurspublic int exactMatchSearch(CharSequence key, int offset, int length, int nodePos)
key - the string to be searched foroffset - starting position in the specified keylength - length of the specified keynodePos - starting position for search in double array nodepublic int exactMatchSearch(CharSequence key, int offset, int length)
key - the string to be searched foroffset - starting position in the specified keylength - length of the specified keypublic int exactMatchSearch(CharSequence key, int offset)
key - the string to be searched foroffset - starting position in the specified keypublic int exactMatchSearch(CharSequence key)
key - the string to be searched forpublic List<DoubleArrayTrie.Result> commonPrefixSearch(CharSequence key, int offset, int length, int nodePos)
key - the string to be searched foroffset - starting position in the keylength - length of keynodePos - starting position for search in double array node.public List<DoubleArrayTrie.Result> commonPrefixSearch(CharSequence key, int offset, int length)
key - the string to be searched foroffset - starting position in the keylength - length of keypublic List<DoubleArrayTrie.Result> commonPrefixSearch(CharSequence key, int offset)
key - the string to be searched foroffset - starting position in the keylength - length of keypublic List<DoubleArrayTrie.Result> commonPrefixSearch(CharSequence key)
key - the string to be searched forpublic DoubleArrayTrie.Result getLongestCommonPrefix(CharSequence key, int offset, int length, int nodePos)
key - the string to be searched foroffset - offset of specified keylength - length of specified keynodePos - starting position for search in double array node.DoubleArrayTrie.Result object that contains length of
prefix and value which is associated with prefix.public DoubleArrayTrie.Result getLongestCommonPrefix(CharSequence key, int offset, int length)
key - the string to be searched foroffset - offset of specified keylength - length of specified keyDoubleArrayTrie.Result object that contains length of
prefix and value which is associated with prefix.public DoubleArrayTrie.Result getLongestCommonPrefix(CharSequence key, int offset)
key - the string to be searched foroffset - offset of specified keyDoubleArrayTrie.Result object that contains length of
prefix and value which is associated with prefix.public DoubleArrayTrie.Result getLongestCommonPrefix(CharSequence key)
key - the string to be searched foroffset - offset of specified keyDoubleArrayTrie.Result object that contains length of
prefix and value which is associated with prefix.Copyright © 2016 New York University. All rights reserved.