public class MDAG extends Object implements ICacheAble
| 限定符和类型 | 字段和说明 |
|---|---|
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(BufferedReader dataFileBufferedReader)
从一个打开的BufferedReader构造
|
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. |
MDAG(String path)
从文件路径构造
|
| 限定符和类型 | 方法和说明 |
|---|---|
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()
解压缩
|
protected MDAGNode sourceNode
protected SimpleMDAGNode simplifiedSourceNode
protected HashMap<MDAGNode,MDAGNode> equivalenceClassMDAGNodeHashMap
protected SimpleMDAGNode[] mdagDataArray
protected int transitionCount
public MDAG(String path) throws IOException
path - IOExceptionpublic MDAG(File dataFile) throws IOException
dataFile - a File representation of a file
containing the Strings that the MDAG will containIOException - if datafile cannot be opened, or a read operation on it cannot be carried outpublic MDAG(BufferedReader dataFileBufferedReader) throws IOException
dataFileBufferedReader - IOExceptionpublic MDAG(Collection<String> strCollection)
strCollection - a Collection containing Strings that the MDAG will containpublic MDAG()
public void save(DataOutputStream out) throws Exception
ICacheAblesave 在接口中 ICacheAbleExceptionpublic boolean load(ByteArray byteArray)
ICacheAbleload 在接口中 ICacheAblepublic final void addStrings(Collection<String> strCollection)
strCollection - a Collection containing Strings to be added to the MDAGpublic void addString(String str)
str - the String to be added to the MDAGpublic void removeString(String str)
str - the String to be removed from the MDAGpublic void simplify()
public void unSimplify()
public boolean contains(String str)
str - the String to be searched forstr is present in the MDAG, and false otherwisepublic HashSet<String> getAllStrings()
public HashSet<String> getStringsStartingWith(String prefixStr)
prefixStr - a String that is the prefix for all the desired StringsprefixStringpublic HashSet<String> getStringsWithSubstring(String str)
str - a String that is contained in all the desired StringsprefixStringpublic HashSet<String> getStringsEndingWith(String suffixStr)
suffixStr - a String that is the suffix for all the desired StringssuffixStrpublic SimpleMDAGNode[] getSimpleMDAGArray()
Copyright © 2014–2017 码农场. All rights reserved.