示例#1
0
文件: Net.cs 项目: utrack/PetriNetSim
        private void Traverse(Dictionary<string, int> marking, Tree.Node tNode)
        {
            if (MarkFound != null)
                MarkFound(marking, tNode.Marking);

            if (StateExists(marking)) return;
            _foundMarkings.Add(marking);

            foreach (var newMarking in from trans in _transitions.Values
                                       where trans.ReadyForTransition(marking)
                                       select new { Mark = trans.Transit(marking), netNode = trans})
            {
                SetMaxMarks(newMarking.Mark);
                var node = new Tree.Node(newMarking.Mark, newMarking.netNode.Name);
                tNode.Children.Add(node);

                Traverse(newMarking.Mark,node);
            }
        }
示例#2
0
文件: Net.cs 项目: utrack/PetriNetSim
 public void Traverse()
 {
     _startNode = new Tree.Node(_defMarking, "Root");
     Traverse(new Dictionary<string, int>(_defMarking),_startNode);
 }