com.hankcs.hanlp.collection.dartsclone
类 DoubleArray

java.lang.Object
  继承者 com.hankcs.hanlp.collection.dartsclone.DoubleArray
直接已知子类:
DartMap

public class DoubleArray
extends Object

双数组DAWG

作者:
manabe

构造方法摘要
DoubleArray()
           
 
方法摘要
 void build(byte[][] keys, int[] values)
          构建
 void build(List<String> keys, int[] values)
           
 List<Pair<Integer,Integer>> commonPrefixSearch(byte[] key, int offset, int maxResults)
          Returns the keys that begins with the given key and its corresponding values.
 int exactMatchSearch(byte[] key)
          Returns the corresponding value if the key is found.
 int exactMatchSearch(String key)
          Returns the corresponding value if the key is found.
 void open(InputStream stream)
          Read from a stream.
 void save(OutputStream stream)
          Saves the trie data into a stream.
 int size()
          大小
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

DoubleArray

public DoubleArray()
方法详细信息

build

public void build(byte[][] keys,
                  int[] values)
构建

参数:
keys - 字节形式的键
values - 值

build

public void build(List<String> keys,
                  int[] values)

open

public void open(InputStream stream)
          throws IOException
Read from a stream. The stream must implement the available() method.

参数:
stream -
抛出:
IOException

save

public void save(OutputStream stream)
          throws IOException
Saves the trie data into a stream.

参数:
stream -
抛出:
IOException

exactMatchSearch

public int exactMatchSearch(String key)
Returns the corresponding value if the key is found. Otherwise returns -1. This method converts the key into UTF-8.

参数:
key - search key
返回:
found value

exactMatchSearch

public int exactMatchSearch(byte[] key)
Returns the corresponding value if the key is found. Otherwise returns -1.

参数:
key - search key
返回:
found value

commonPrefixSearch

public List<Pair<Integer,Integer>> commonPrefixSearch(byte[] key,
                                                      int offset,
                                                      int maxResults)
Returns the keys that begins with the given key and its corresponding values. The first of the returned pair represents the length of the found key.

参数:
key -
offset -
maxResults -
返回:
found keys and values

size

public int size()
大小

返回:


Copyright © 2014–2015 鐮佸啘鍦�/a>. All rights reserved.