private int createSimpleMDAGTransitionSet ( MDAGNode node , SimpleMDAGNode [ ] mdagDataArray , int onePastLastCreatedTransitionSetIndex ) { int pivotIndex = onePastLastCreatedTransitionSetIndex ; // node自己的位置 node . setTransitionSetBeginIndex ( pivotIndex ) ; onePastLastCreatedTransitionSetIndex += node . getOutgoingTransitionCount ( ) ; // 这个参数代表id的消耗 //Create a SimpleMDAGNode representing each _transition label/target combo in transitionTreeMap, recursively calling this method (if necessary) //to set indices in these SimpleMDAGNodes that the set of transitions emitting from their respective _transition targets starts from. TreeMap < Character , MDAGNode > transitionTreeMap = node . getOutgoingTransitions ( ) ; for ( Entry < Character , MDAGNode > transitionKeyValuePair : transitionTreeMap . entrySet ( ) ) { //Use the current _transition's label and target node to create a SimpleMDAGNode //(which is a space-saving representation of the _transition), and insert it in to mdagDataArray char transitionLabelChar = transitionKeyValuePair . getKey ( ) ; MDAGNode transitionTargetNode = transitionKeyValuePair . getValue ( ) ; mdagDataArray [ pivotIndex ] = new SimpleMDAGNode ( transitionLabelChar , transitionTargetNode . isAcceptNode ( ) , transitionTargetNode . getOutgoingTransitionCount ( ) ) ; ///// //If targetTransitionNode's outgoing _transition set hasn't been inserted in to mdagDataArray yet, call this method on it to do so. //After this call returns, transitionTargetNode will contain the index in mdagDataArray that its _transition set starts from if ( transitionTargetNode . getTransitionSetBeginIndex ( ) == - 1 ) onePastLastCreatedTransitionSetIndex = createSimpleMDAGTransitionSet ( transitionTargetNode , mdagDataArray , onePastLastCreatedTransitionSetIndex ) ; mdagDataArray [ pivotIndex ++ ] . setTransitionSetBeginIndex ( transitionTargetNode . getTransitionSetBeginIndex ( ) ) ; } ///// return onePastLastCreatedTransitionSetIndex ; }
Creates a SimpleMDAGNode version of an MDAGNode s outgoing _transition set in mdagDataArray .