public GetLocalInputAddress ( int port ) : |
||
port | int | |
Результат |
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); }
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()); }
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); }
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); }
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); }