com.hankcs.hanlp.collection.MDAG
类 MDAGNode

java.lang.Object
  继承者 com.hankcs.hanlp.collection.MDAG.MDAGNode

public class MDAGNode
extends Object

MDAG中的一个节点
The class which represents a node in a MDAG.

作者:
Kevin

构造方法摘要
MDAGNode(boolean isAcceptNode)
          建立一个节点
Constructs an MDAGNode.
 
方法摘要
 MDAGNode addOutgoingTransition(char letter, boolean targetAcceptStateStatus)
          新建一个转移目标
Creates an outgoing _transition labeled with a given char that has a new node as its target.
 MDAGNode addOutgoingTransition(char letter, MDAGNode newTargetNode)
          建立一条边(起点是自己)
 void clearStoredHashCode()
          Clears this node's stored hash value
 MDAGNode clone()
          克隆一个状态
Creates an MDAGNode possessing the same accept state status and outgoing transitions as this node.
 MDAGNode clone(MDAGNode soleParentNode, char parentToCloneTransitionLabelChar)
          克隆一个状态
原来soleParentNode转移到本状态,现在转移到克隆后的状态 Creates an MDAGNode possessing the same accept state status ant _transition set (incoming & outgoing) as this node. outgoing transitions as this node.
 void decrementTargetIncomingTransitionCounts()
          本状态的目标状态们的入度减一 Decrements (by 1) the incoming _transition counts of all of the nodes that are targets of outgoing transitions from this node.
 boolean equals(Object obj)
          两个状态是否等价,只有状态转移函数完全一致才算相等
Evaluates the equality of this node with another object.
 int getIncomingTransitionCount()
          Retrieves this node's incoming _transition count
 int getOutgoingTransitionCount()
          Retrieves this node's outgoing _transition count.
 TreeMap<Character,MDAGNode> getOutgoingTransitions()
          Retrieves this node's outgoing transitions.
 Stack<MDAGNode> getTransitionPathNodes(String str)
          获取一个字符串路径上经过的节点
Retrieves the nodes in the _transition path starting from this node corresponding to a given String .
 int getTransitionSetBeginIndex()
          Retrieves the index in a simplified mdag data array that the SimpleMDAGNode representation of this node's outgoing _transition set begins at.
 int hashCode()
          Hashes this node using its accept state status and set of outgoing _transition paths.
 boolean hasOutgoingTransition(char letter)
          Determines whether this node has an outgoing _transition with a given label.
 boolean hasTransitions()
          Determines whether this node has any outgoing transitions.
static boolean haveSameTransitions(MDAGNode node1, MDAGNode node2)
          是否含有相同的转移函数
 boolean isAcceptNode()
          Retrieves the accept state status of this node.
 boolean isConfluenceNode()
          Determines if this node is a confluence node (defined as a node with two or more incoming transitions
 void reassignOutgoingTransition(char letter, MDAGNode oldTargetNode, MDAGNode newTargetNode)
          重新设置转移状态函数的目标 Reassigns the target node of one of this node's outgoing transitions.
 void removeOutgoingTransition(char letter)
          移除一个转移目标
Removes a _transition labeled with a given char.
 void setAcceptStateStatus(boolean isAcceptNode)
          Sets this node's accept state status.
 void setTransitionSetBeginIndex(int transitionSetBeginIndex)
          转移状态在数组中的起始下标
Records the index that this node's _transition set starts at in an array containing this node's containing MDAG data (simplified MDAG).
 String toString()
           
 MDAGNode transition(char letter)
          Follows an outgoing _transition of this node labeled with a given char.
 MDAGNode transition(char[] str)
           
 MDAGNode transition(char[] str, int offset)
           
 MDAGNode transition(String str)
          沿着一个路径转移
Follows a _transition path starting from this node.
 
从类 java.lang.Object 继承的方法
finalize, getClass, notify, notifyAll, wait, wait, wait
 

构造方法详细信息

MDAGNode

public MDAGNode(boolean isAcceptNode)
建立一个节点
Constructs an MDAGNode.

参数:
isAcceptNode - 是否是终止状态 a boolean denoting the accept state status of this node
方法详细信息

clone

public MDAGNode clone()
克隆一个状态
Creates an MDAGNode possessing the same accept state status and outgoing transitions as this node.

覆盖:
Object 中的 clone
返回:
an MDAGNode possessing the same accept state status and outgoing transitions as this node

clone

public MDAGNode clone(MDAGNode soleParentNode,
                      char parentToCloneTransitionLabelChar)
克隆一个状态
原来soleParentNode转移到本状态,现在转移到克隆后的状态 Creates an MDAGNode possessing the same accept state status ant _transition set (incoming & outgoing) as this node. outgoing transitions as this node.

参数:
soleParentNode - the MDAGNode possessing the only _transition that targets this node
parentToCloneTransitionLabelChar - the char which labels the _transition from soleParentNode to this node
返回:
an MDAGNode possessing the same accept state status and _transition set as this node.

getTransitionSetBeginIndex

public int getTransitionSetBeginIndex()
Retrieves the index in a simplified mdag data array that the SimpleMDAGNode representation of this node's outgoing _transition set begins at.

返回:
the index in a simplified mdag data array that this node's _transition set begins at, or -1 if its _transition set is not present in such an array

getOutgoingTransitionCount

public int getOutgoingTransitionCount()
Retrieves this node's outgoing _transition count.

返回:
an int representing this node's number of outgoing transitions

getIncomingTransitionCount

public int getIncomingTransitionCount()
Retrieves this node's incoming _transition count

返回:
an int representing this node's number of incoming transitions

isConfluenceNode

public boolean isConfluenceNode()
Determines if this node is a confluence node (defined as a node with two or more incoming transitions

返回:
true if this node has two or more incoming transitions, false otherwise

isAcceptNode

public boolean isAcceptNode()
Retrieves the accept state status of this node.

返回:
true if this node is an accept state, false otherwise

setAcceptStateStatus

public void setAcceptStateStatus(boolean isAcceptNode)
Sets this node's accept state status.

参数:
isAcceptNode - a boolean representing the desired accept state status

setTransitionSetBeginIndex

public void setTransitionSetBeginIndex(int transitionSetBeginIndex)
转移状态在数组中的起始下标
Records the index that this node's _transition set starts at in an array containing this node's containing MDAG data (simplified MDAG).

参数:
transitionSetBeginIndex - a _transition set

hasOutgoingTransition

public boolean hasOutgoingTransition(char letter)
Determines whether this node has an outgoing _transition with a given label.

参数:
letter - the char labeling the desired _transition
返回:
true if this node possesses a _transition labeled with letter, and false otherwise

hasTransitions

public boolean hasTransitions()
Determines whether this node has any outgoing transitions.

返回:
true if this node has at least one outgoing _transition, false otherwise

transition

public MDAGNode transition(char letter)
Follows an outgoing _transition of this node labeled with a given char.

参数:
letter - the char representation of the desired _transition's label
返回:
the MDAGNode that is the target of the _transition labeled with letter, or null if there is no such labeled _transition from this node

transition

public MDAGNode transition(String str)
沿着一个路径转移
Follows a _transition path starting from this node.

参数:
str - a String corresponding a _transition path in the MDAG
返回:
the MDAGNode at the end of the _transition path corresponding to str, or null if such a _transition path is not present in the MDAG

transition

public MDAGNode transition(char[] str)

transition

public MDAGNode transition(char[] str,
                           int offset)

getTransitionPathNodes

public Stack<MDAGNode> getTransitionPathNodes(String str)
获取一个字符串路径上经过的节点
Retrieves the nodes in the _transition path starting from this node corresponding to a given String .

参数:
str - a String corresponding to a _transition path starting from this node
返回:
a Stack of MDAGNodes containing the nodes in the _transition path denoted by str, in the order they are encountered in during transitioning

getOutgoingTransitions

public TreeMap<Character,MDAGNode> getOutgoingTransitions()
Retrieves this node's outgoing transitions.

返回:
a TreeMap containing entries collectively representing all of this node's outgoing transitions

decrementTargetIncomingTransitionCounts

public void decrementTargetIncomingTransitionCounts()
本状态的目标状态们的入度减一 Decrements (by 1) the incoming _transition counts of all of the nodes that are targets of outgoing transitions from this node.


reassignOutgoingTransition

public void reassignOutgoingTransition(char letter,
                                       MDAGNode oldTargetNode,
                                       MDAGNode newTargetNode)
重新设置转移状态函数的目标 Reassigns the target node of one of this node's outgoing transitions.

参数:
letter - the char which labels the outgoing _transition of interest
oldTargetNode - the MDAGNode that is currently the target of the _transition of interest
newTargetNode - the MDAGNode that is to be the target of the _transition of interest

addOutgoingTransition

public MDAGNode addOutgoingTransition(char letter,
                                      boolean targetAcceptStateStatus)
新建一个转移目标
Creates an outgoing _transition labeled with a given char that has a new node as its target.

参数:
letter - a char representing the desired label of the _transition
targetAcceptStateStatus - a boolean representing to-be-created _transition target node's accept status
返回:
the (newly created) MDAGNode that is the target of the created _transition

addOutgoingTransition

public MDAGNode addOutgoingTransition(char letter,
                                      MDAGNode newTargetNode)
建立一条边(起点是自己)

参数:
letter - 边上的字符串
newTargetNode - 边的重点
返回:
终点

removeOutgoingTransition

public void removeOutgoingTransition(char letter)
移除一个转移目标
Removes a _transition labeled with a given char. This only removes the connection between this node and the _transition's target node; the target node is not deleted.

参数:
letter - the char labeling the _transition of interest

haveSameTransitions

public static boolean haveSameTransitions(MDAGNode node1,
                                          MDAGNode node2)
是否含有相同的转移函数

参数:
node1 -
node2 -
返回:

clearStoredHashCode

public void clearStoredHashCode()
Clears this node's stored hash value


equals

public boolean equals(Object obj)
两个状态是否等价,只有状态转移函数完全一致才算相等
Evaluates the equality of this node with another object. This node is equal to obj if and only if obj is also an MDAGNode, and the set of transitions paths from this node and obj are equivalent.

覆盖:
Object 中的 equals
参数:
obj - an object
返回:
true of obj is an MDAGNode and the set of _transition paths from this node and obj are equivalent

hashCode

public int hashCode()
Hashes this node using its accept state status and set of outgoing _transition paths. This is an expensive operation, so the result is cached and only cleared when necessary.

覆盖:
Object 中的 hashCode
返回:
an int of this node's hash code

toString

public String toString()
覆盖:
Object 中的 toString


Copyright © 2014–2015 码农场. All rights reserved.