private E_CLOSURE_NODE Perform_MoveToOperation(E_CLOSURE_NODE eClosureNode, Dictionary <char, Stack <NODE> > moveToDictionary) { E_CLOSURE_NODE eClosureNode_it = Find_EClosureNode(eClosureNode); E_CLOSURE_NODE return_eClosureNode; if (eClosureNode_it != null) { eClosureNode.Delete(); return_eClosureNode = eClosureNode_it; } else { eClosureNodes.Add(eClosureNode.NodeID, eClosureNode); foreach (KeyValuePair <char, Stack <NODE> > moveTo in moveToDictionary) { EDGE newEClosureEdge = new EDGE(moveTo.Key, Get_EClosureNode(moveTo.Value)); eClosureNode.edges.Add(newEClosureEdge); } return_eClosureNode = eClosureNode; } return(return_eClosureNode); }
private bool ContainsEdge(List <EDGE> edges, EDGE newEdge) { bool isContained = false; foreach (EDGE edge in edges) { if (edge.transitionCharacter == newEdge.transitionCharacter) { isContained = true; } } return(isContained); }
private void Get_DFAFromDFASets() { List <NODE> localDFANodes = new List <NODE>(); if (DFASets.Count < DFANodes.Count) { foreach (NODES_SET DFASets_it in DFASets) { localDFANodes.Add(new NODE(NODE_TYPE.TRANSITIONING, DFASets_it.id)); } foreach (NODES_SET DFASets_it in DFASets) { foreach (NODE Nodes_it in DFASets_it.nodesSet) { foreach (EDGE edges_it in Nodes_it.edges) { EDGE newEdge = new EDGE(edges_it.transitionCharacter, localDFANodes[edges_it.nextNode.assignedSet.id]); if (!ContainsEdge(localDFANodes[DFASets_it.id].edges, newEdge)) { localDFANodes[DFASets_it.id].edges.Add(newEdge); } } if (Nodes_it.nodeType == NODE_TYPE.START && localDFANodes[DFASets_it.id].nodeType != NODE_TYPE.END) { localDFANodes[DFASets_it.id].nodeType = NODE_TYPE.START; } if (Nodes_it.nodeType == NODE_TYPE.END) { localDFANodes[DFASets_it.id].nodeType = NODE_TYPE.END; } } } startNode = localDFANodes[startNode.assignedSet.id]; } }