Esempio n. 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);
 }
Esempio n. 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;
        }
Esempio n. 3
0
        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;
            }
        }