public Circuit(int gateCount) { Gates = new Gate[gateCount]; ExternalGate = new ExternalGate(this); InputStream = new GateOutput(ExternalGate, GateConnection.SideType.X); OutputStream = new GateInput(ExternalGate, GateConnection.SideType.X); }
public Gate(Circuit circuit, int index) { Circuit = circuit; InputL = new GateInput(this, GateConnection.SideType.L); InputR = new GateInput(this, GateConnection.SideType.R); OutputL = new GateOutput(this, GateConnection.SideType.L); OutputR = new GateOutput(this, GateConnection.SideType.R); Inputs[0] = InputL; Inputs[1] = InputR; Outputs[0] = OutputL; Outputs[1] = OutputR; _index = index; }
public void ConnectTo(GateOutput source) { if (source == Source) { return; } if (source != null && source.Target != null) { source.Target.Source = null; } if (Source != null) { Source.Target = null; } Source = source; if (Source != null) { Source.Target = this; } }