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); }
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); }
public static IEnumerable <WireView> ConnectedInputWires(SchemeView scheme, GateView gate) { return(scheme.Wires.Where(w => gate.WireEndConnects(w))); }