Esempio n. 1
0
        public Net(string file)
        {
            var dFile = new FLDataFile.DataFile(file);

            foreach (var set in dFile.GetSections("Node"))
            {
                var name = set.GetFirstOf("name")[0];
                var newNode = new Node(name);
                _defMarking[name] = int.Parse(set.GetFirstOf("tokens")[0]);
                _maxMarks[name] = _defMarking[name];
                _nodes.Add(name,newNode);
            }

            foreach (var name in dFile.GetSections("Transition").Select(sec => sec.GetFirstOf("name")[0]))
            {
                _transitions.Add(name, new Transition(name));
            }

            foreach (var set in dFile.GetSettings("NodeToTransition", "connection"))
            {
                _nodes[set[0]].AddOutput(_transitions[set[1]]);
                _transitions[set[1]].AddInput(_nodes[set[0]]);
            }

            foreach (var set in dFile.GetSettings("TransitionToNode", "connection"))
            {
                _transitions[set[0]].AddOutput(_nodes[set[1]]);
                _nodes[set[1]].AddInput(_transitions[set[0]]);
            }
        }
Esempio n. 2
0
 public void AddOutput(Node trans)
 {
     Outputs.Add(trans);
 }
Esempio n. 3
0
 public void AddInput(Node trans)
 {
     Inputs.Add(trans);
 }