Beispiel #1
0
 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);
 }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        public void ConnectTo(GateInput target)
        {
            if (Target == target)
            {
                return;
            }

            if (target != null && target.Source != null)
            {
                target.Source.Target = null;
            }

            if (Target != null)
            {
                Target.Source = null;
            }

            Target = target;

            if (target != null)
            {
                target.Source = this;
            }
        }