public static void Connect(this SchemeView scheme, GateView source, ExternalPortView destination, int index = 0) { var sourcePort = source.Outputs.ElementAt(index); sourcePort.Tap(); destination.Tap(); var lastWire = scheme.Wires.Last(); Debug.Assert(source.WireStartConnects(lastWire)); Debug.Assert(destination.WireEndConnects(lastWire)); Debug.Assert(lastWire.Connection.StartPort == 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> ConnectedOutputWires(SchemeView scheme, GateView gate) { return(scheme.Wires.Where(w => gate.WireStartConnects(w))); }