public void AddNode(LogicNode node)
 {
     if (!nodeNames.ContainsKey(node.Name))
     {
         nodeNames.Add(node.Name, node);
     }
     else
     {
         throw new DuplicateNodeNameException();
     }
 }
Example #2
0
        public void ConnectInput(LogicNode input)
        {
            //Connects another node as an input

            if (!inputs.Contains(input))
            {
                if ((maxInputs < 0) || (inputs.Count < maxInputs))
                {
                    inputs.Add(input);
                }
                else
                {
                    throw new TooManyInputsException();
                }
            }
        }
        public void AddNode(LogicNode node, NodeType type = NodeType.internalNode)
        {
            //Adds a node to the circuit.

            if (!nodes.Contains(node))
            {
                nodes.Add(node);

                //If it's an input or an output node, add it to the respective lists.
                if (type == NodeType.inputNode)
                {
                    inputNodes.Add(node);
                }
                else if (type == NodeType.outputNode)
                {
                    outputNodes.Add(node);
                }
            }
        }
Example #4
0
 public void ConnectOutput(LogicNode output)
 {
     //Connects another node as an output
     output.ConnectInput(this);
 }
        private void ProcessNodeParams(LogicNode node, string[] parameters)
        {
            IntegratedCircuitParseData circuit = circuitStack.Peek();

            //Add the name to this circuit's parse data.
            circuit.AddNode(node);

            //Link the inputs, if there are any.
            LinkInputs(parameters);
        }