Ejemplo n.º 1
0
 public void Link(NFA_Node from_node, NFA_Node to_node)
 {
     FromNode = from_node;
     ToNode   = to_node;
     from_node.AddOutputLine(this);
     to_node.AddInputLine(this);
 }
Ejemplo n.º 2
0
        public void CreateNFA()
        {
            for (int i = 0; i < 11; i++)
            {
                NFA_Node node = new NFA_Node(i);
                Nodes.Add(node);
            }
            Nodes[0].IsStartNode = true;
            Nodes[0].IsEndNode   = true;
            NFA_Line line;

            line = new NFA_Line(null, Nodes[0], Nodes[1]);
            line = new NFA_Line(null, Nodes[1], Nodes[2]);
            line = new NFA_Line("a", Nodes[2], Nodes[3]);
            line = new NFA_Line(null, Nodes[3], Nodes[4]);
            line = new NFA_Line("b", Nodes[4], Nodes[5]);
            line = new NFA_Line(null, Nodes[5], Nodes[10]);
            line = new NFA_Line(null, Nodes[10], Nodes[0]);

            line = new NFA_Line(null, Nodes[1], Nodes[6]);
            line = new NFA_Line("c", Nodes[6], Nodes[7]);
            line = new NFA_Line(null, Nodes[7], Nodes[8]);
            line = new NFA_Line("d", Nodes[8], Nodes[9]);
            line = new NFA_Line(null, Nodes[9], Nodes[10]);
        }
Ejemplo n.º 3
0
 public NFA_Line(string text = null, NFA_Node from_node = null, NFA_Node to_node = null)
 {
     Text     = text;
     FromNode = from_node;
     ToNode   = to_node;
     if (from_node != null)
     {
         from_node.AddOutputLine(this);
     }
     if (to_node != null)
     {
         to_node.AddInputLine(this);
     }
 }