Exemplo n.º 1
0
        public SchemeState(Topology.Topology topology)
        {
            Gates = topology.Gates.ToDictionary(x => x, x => new GateState(x, false));
            Nodes = topology.Nodes.ToDictionary(x => x, x => new NodeState(x, false));

            InputPins  = topology.Pins.Where(x => !x.IsOutputPin).ToArray();
            OutputPins = topology.Pins.Where(x => x.IsOutputPin).ToArray();

            PinNodes = topology.Pins.ToDictionary(
                p => p,
                p => (IReadOnlyList <SchemeNode>)topology.Nodes.Where(n => n.Pins.Contains(p)).ToArray());

            InputPinStates            = InputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions)));
            OutputPinStates           = OutputPins.ToDictionary(x => x, x => new PinState(x, false, x.ValuesFunction.Begin(topology.ValuesFunctions)));
            GeneratedOutputPinsStates = OutputPins.ToDictionary(x => x, _ => false);
        }