GetLocalOutputAddress() публичный Метод

public GetLocalOutputAddress ( int port ) : OutputGateAddress
port int
Результат OutputGateAddress
Пример #1
0
        private static Quorum[] GetParticipatingQuorumList(Gate evalGate, IDictionary <Gate, Quorum> gateQuorumMapping, Circuit circuit)
        {
            List <Quorum> quorums = new List <Quorum>();

            // first add where we're receiving from
            for (int i = 0; i < evalGate.InputCount; i++)
            {
                if (circuit.InputConnectionCounterparties.ContainsKey(evalGate.GetLocalInputAddress(i)))
                {
                    var counterpartGate = circuit.InputConnectionCounterparties[evalGate.GetLocalInputAddress(i)].Gate;
                    quorums.Add(gateQuorumMapping[counterpartGate]);
                }
            }

            quorums.Add(gateQuorumMapping[evalGate]);

            // then add where we're sending to
            for (int i = 0; i < evalGate.OutputCount; i++)
            {
                if (circuit.OutputConnectionCounterparties.ContainsKey(evalGate.GetLocalOutputAddress(i)))
                {
                    var counterpartGate = circuit.OutputConnectionCounterparties[evalGate.GetLocalOutputAddress(i)].Gate;
                    quorums.Add(gateQuorumMapping[counterpartGate]);
                }
            }

            return(quorums.ToArray());
        }
Пример #2
0
        public void AppendGate(Gate gate, int[] wires)
        {
            Debug.Assert(gate.InputCount == gate.OutputCount);
            Debug.Assert(gate.InputCount == wires.Length);

            ISet <GateConnection> joins = new HashSet <GateConnection>();

            for (int i = 0; i < wires.Length; i++)
            {
                int wire = wires[i];
                if (LastGateForWire[wire] != null)
                {
                    joins.Add(new GateConnection(LastGateForWire[wire], gate.GetLocalInputAddress(i)));
                }

                LastGateForWire[wire] = gate.GetLocalOutputAddress(i);
                if (FirstGateForWire[wire] == null)
                {
                    FirstGateForWire[wire] = gate.GetLocalInputAddress(i);
                }

                WireGateList[wire].Add(gate);
            }

            Circuit.AddGate(gate, joins);
        }
Пример #3
0
        public void RemoveGate(Gate gate)
        {
            for (int i = 0; i < gate.InputCount; i++)
            {
                var inAddr = gate.GetLocalInputAddress(i);
                Debug.Assert(!InputConnectionCounterparties.ContainsKey(inAddr));
                InputAddrs.Remove(inAddr);
            }

            for (int i = 0; i < gate.OutputCount; i++)
            {
                var outAddr = gate.GetLocalOutputAddress(i);
                Debug.Assert(!OutputConnectionCounterparties.ContainsKey(outAddr));
                OutputAddrs.Remove(outAddr);
            }

            Gates.Remove(gate);
        }
Пример #4
0
        public void AppendGate(Gate gate, int[] wires)
        {
            Debug.Assert(gate.InputCount == gate.OutputCount);
            Debug.Assert(gate.InputCount == wires.Length);

            ISet<GateConnection> joins = new HashSet<GateConnection>();

            for (int i = 0; i < wires.Length; i++)
            {
                int wire = wires[i];
                if (LastGateForWire[wire] != null)
                    joins.Add(new GateConnection(LastGateForWire[wire], gate.GetLocalInputAddress(i)));

                LastGateForWire[wire] = gate.GetLocalOutputAddress(i);
                if (FirstGateForWire[wire] == null)
                    FirstGateForWire[wire] = gate.GetLocalInputAddress(i);

                WireGateList[wire].Add(gate);
            }

            Circuit.AddGate(gate, joins);
        }
Пример #5
0
        public void RemoveGate(Gate gate)
        {
            for (int i = 0; i < gate.InputCount; i++)
            {
                var inAddr = gate.GetLocalInputAddress(i);
                Debug.Assert(!InputConnectionCounterparties.ContainsKey(inAddr));
                InputAddrs.Remove(inAddr);
            }

            for (int i = 0; i < gate.OutputCount; i++)
            {
                var outAddr = gate.GetLocalOutputAddress(i);
                Debug.Assert(!OutputConnectionCounterparties.ContainsKey(outAddr));
                OutputAddrs.Remove(outAddr);
            }

            Gates.Remove(gate);
        }