com.hankcs.hanlp.collection.MDAG
类 MDAG

java.lang.Object
  继承者 com.hankcs.hanlp.collection.MDAG.MDAG
所有已实现的接口:
ICacheAble
直接已知子类:
MDAGSet

public class MDAG
extends Object
implements ICacheAble

最小环形图
A minimalistic directed acyclical graph suitable for storing a set of Strings.

作者:
Kevin

字段摘要
protected  TreeSet<Character> charTreeSet
          字母表
protected  HashMap<MDAGNode,MDAGNode> equivalenceClassMDAGNodeHashMap
          等价类集合,相当于论文中的register
protected  SimpleMDAGNode[] mdagDataArray
          调用simplify()后填充此空间
protected  SimpleMDAGNode simplifiedSourceNode
          简化后的根节点(简化指的是用数组简化,而不是最小化,这个结构永远是最小化的)
protected  MDAGNode sourceNode
          根节点
protected  int transitionCount
          所有边的数量
 
构造方法摘要
MDAG()
          空白图
MDAG(Collection<String> strCollection)
          Creates an MDAG from a collection of Strings.
MDAG(File dataFile)
          从一个文件建立MDAG
Creates an MDAG from a newline delimited file containing the data of interest.
 
方法摘要
 HashMap<MDAGNode,MDAGNode> _getEquivalenceClassMDAGNodeHashMap()
          调试用
 void addString(String str)
          Adds a string to the MDAG.
 void addStrings(Collection<String> strCollection)
          Adds a Collection of Strings to the MDAG.
 boolean contains(String str)
          是否包含
Determines whether a String is present in the MDAG.
 HashSet<String> getAllStrings()
          取出所有key
Retrieves all the valid Strings that have been inserted in to the MDAG.
 SimpleMDAGNode[] getSimpleMDAGArray()
          获取简化后的状态Array
Returns the array of SimpleMDAGNodes collectively containing the data of this MDAG, or null if it hasn't been simplified yet.
 HashSet<String> getStringsEndingWith(String suffixStr)
          后缀查询
Retrieves all the Strings in the MDAG that begin with a given String.
 HashSet<String> getStringsStartingWith(String prefixStr)
          前缀查询
Retrieves all the Strings in the MDAG that begin with a given String.
 HashSet<String> getStringsWithSubstring(String str)
          返回包含字串的key
Retrieves all the Strings in the MDAG that contain a given String.
 boolean load(ByteArray byteArray)
          载入
 void removeString(String str)
          Removes a String from the MDAG.
 void save(DataOutputStream out)
          写入
 void simplify()
          固化自己
Creates a space-saving version of the MDAG in the form of an array.
 void unSimplify()
          解压缩
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

sourceNode

protected MDAGNode sourceNode
根节点


simplifiedSourceNode

protected SimpleMDAGNode simplifiedSourceNode
简化后的根节点(简化指的是用数组简化,而不是最小化,这个结构永远是最小化的)


equivalenceClassMDAGNodeHashMap

protected HashMap<MDAGNode,MDAGNode> equivalenceClassMDAGNodeHashMap
等价类集合,相当于论文中的register


mdagDataArray

protected SimpleMDAGNode[] mdagDataArray
调用simplify()后填充此空间


charTreeSet

protected TreeSet<Character> charTreeSet
字母表


transitionCount

protected int transitionCount
所有边的数量

构造方法详细信息

MDAG

public MDAG(File dataFile)
     throws IOException
从一个文件建立MDAG
Creates an MDAG from a newline delimited file containing the data of interest.

参数:
dataFile - a File representation of a file containing the Strings that the MDAG will contain
抛出:
IOException - if datafile cannot be opened, or a read operation on it cannot be carried out

MDAG

public MDAG(Collection<String> strCollection)
Creates an MDAG from a collection of Strings.

参数:
strCollection - a Collection containing Strings that the MDAG will contain

MDAG

public MDAG()
空白图

方法详细信息

save

public void save(DataOutputStream out)
          throws Exception
从接口 ICacheAble 复制的描述
写入

指定者:
接口 ICacheAble 中的 save
抛出:
Exception

load

public boolean load(ByteArray byteArray)
从接口 ICacheAble 复制的描述
载入

指定者:
接口 ICacheAble 中的 load
返回:

addStrings

public final void addStrings(Collection<String> strCollection)
Adds a Collection of Strings to the MDAG.

参数:
strCollection - a Collection containing Strings to be added to the MDAG

addString

public void addString(String str)
Adds a string to the MDAG.

参数:
str - the String to be added to the MDAG

removeString

public void removeString(String str)
Removes a String from the MDAG.

参数:
str - the String to be removed from the MDAG

simplify

public void simplify()
固化自己
Creates a space-saving version of the MDAG in the form of an array. Once the MDAG is simplified, Strings can no longer be added to or removed from it.


unSimplify

public void unSimplify()
解压缩


contains

public boolean contains(String str)
是否包含
Determines whether a String is present in the MDAG.

参数:
str - the String to be searched for
返回:
true if str is present in the MDAG, and false otherwise

getAllStrings

public HashSet<String> getAllStrings()
取出所有key
Retrieves all the valid Strings that have been inserted in to the MDAG.

返回:
a HashSet containing all the Strings that have been inserted into the MDAG

getStringsStartingWith

public HashSet<String> getStringsStartingWith(String prefixStr)
前缀查询
Retrieves all the Strings in the MDAG that begin with a given String.

参数:
prefixStr - a String that is the prefix for all the desired Strings
返回:
a HashSet containing all the Strings present in the MDAG that begin with prefixString

getStringsWithSubstring

public HashSet<String> getStringsWithSubstring(String str)
返回包含字串的key
Retrieves all the Strings in the MDAG that contain a given String.

参数:
str - a String that is contained in all the desired Strings
返回:
a HashSet containing all the Strings present in the MDAG that begin with prefixString

getStringsEndingWith

public HashSet<String> getStringsEndingWith(String suffixStr)
后缀查询
Retrieves all the Strings in the MDAG that begin with a given String.

参数:
suffixStr - a String that is the suffix for all the desired Strings
返回:
a HashSet containing all the Strings present in the MDAG that end with suffixStr

getSimpleMDAGArray

public SimpleMDAGNode[] getSimpleMDAGArray()
获取简化后的状态Array
Returns the array of SimpleMDAGNodes collectively containing the data of this MDAG, or null if it hasn't been simplified yet.

返回:
the array of SimpleMDAGNodes collectively containing the data of this MDAG if this MDAG has been simplified, or null if it has not

_getEquivalenceClassMDAGNodeHashMap

public HashMap<MDAGNode,MDAGNode> _getEquivalenceClassMDAGNodeHashMap()
调试用

返回:


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