internal FA SynthesizeFinite(FA synth, int lb, int up) { // Create a serial to identify this closure m_currentClosureSerial = ThompsonFAInfo.GetNewClosureSerial(); m_currentFA = CreateNewFA(synth); if (lb == 0) { m_currentFA.AddGraphEdge <CGraphEdge, CGraphNode>(m_newFASource, m_newFATarget, GraphType.GT_DIRECTED); } if (up > 1) { m_currentFA.AddGraphEdge <CGraphEdge, CGraphNode>(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_mergeOperation.GetMirrorNode(synth.M_Initial), GraphType.GT_DIRECTED); m_ThompsonInfo.SetNodeClosureEntrance(m_mergeOperation.GetMirrorNode(synth.M_Initial), m_currentClosureSerial); m_ThompsonInfo.SetNodeClosureExpression(m_mergeOperation.GetMirrorNode(synth.M_Initial), m_closureText); m_ThompsonInfo.SetNodeClosureExit(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_currentClosureSerial); m_ThompsonInfo.SetNodeClosureExpression(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_closureText); } // Update current FA closure Info m_currentFAloop.MLoopSerial = m_currentClosureSerial; m_currentFAloop.MClosureType = FALoop.ClosureType.CT_FINITE; m_currentFAloop.MClosureRange = new Range <int>(lb, up); return(m_currentFA); }
internal FA SynthesisOneOrMul(FA synth) { // Create a serial to identify this closure m_currentClosureSerial = ThompsonFAInfo.GetNewClosureSerial(); m_currentFA = CreateNewFA(synth); // Draw the closure loop edge m_currentFA.AddGraphEdge <CGraphEdge, CGraphNode>(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_mergeOperation.GetMirrorNode(synth.M_Initial), GraphType.GT_DIRECTED); m_ThompsonInfo.SetNodeClosureEntrance(m_mergeOperation.GetMirrorNode(synth.M_Initial), m_currentClosureSerial); m_ThompsonInfo.SetNodeClosureExpression(m_mergeOperation.GetMirrorNode(synth.M_Initial), m_closureText); m_ThompsonInfo.SetNodeClosureExit(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_currentClosureSerial); m_ThompsonInfo.SetNodeClosureExpression(m_mergeOperation.GetMirrorNode(synth.GetFinalStates()[0]), m_closureText); // Update current FA closure Info m_currentFAloop.MLoopSerial = m_currentClosureSerial; m_currentFAloop.MClosureType = FALoop.ClosureType.CT_ONEORMULT; //7.Return result return(m_currentFA); }