Exemple #1
0
    public void run()
    {
        _reader.chooseFile();
        while (true)
        {
            _reader.readFile();

            //Get a dictionary with the actual INode classes in it
            NodeDictionaryBuilder builder = new NodeDictionaryBuilder();
            builder.addNodes(_reader.getNodes());
            builder.addEdges(_reader.getEdges());
            _nodeDictionary = builder.getNodeDictionary();

            getInputsReady();
            validateNodes();

            //Give te user the opportunity to change the default inputs
            _nodeDictionary = _reader.setInputs(_nodeDictionary);

            //Run the simulation, calculate each node output
            foreach (var node in _nodeDictionary)
            {
                node.Value.calculateOutput();
            }

            //Draw the simulation
            _view.draw(_nodeDictionary);
            _view.writeEnd();
        }
    }