示例#1
0
        public static void Connect(this SchemeView scheme, ExternalPortView source, GateView destination, int index = 0)
        {
            source.Tap();

            var destPort = destination.Inputs.ToList().ElementAt(index);

            destPort.Tap();

            var lastWire = scheme.Wires.Last();

            Debug.Assert(source.WireStartConnects(lastWire));
            Debug.Assert(destination.WireEndConnects(lastWire));
            Debug.Assert(lastWire.Connection.EndPort == index);
        }
示例#2
0
        public static void Connect(this SchemeView scheme, GateView source, GateView destination, int srcIndex = 0, int dstIndex = 0)
        {
            var sourcePort = source.Outputs.ElementAt(srcIndex);

            sourcePort.Tap();

            var destinationPort = destination.Inputs.ElementAt(dstIndex);

            destinationPort.Tap();

            var lastWire = scheme.Wires.Last();

            Debug.Assert(source.WireStartConnects(lastWire));
            Debug.Assert(destination.WireEndConnects(lastWire));
            Debug.Assert(lastWire.Connection.StartPort == srcIndex);
            Debug.Assert(lastWire.Connection.EndPort == dstIndex);
        }
示例#3
0
 public static IEnumerable <WireView> ConnectedInputWires(SchemeView scheme, GateView gate)
 {
     return(scheme.Wires.Where(w => gate.WireEndConnects(w)));
 }