/// <summary> /// Adds a new connecting wire to the chip /// </summary> /// <param name="id">Id of circuit to use as start of wire</param> protected void AddWire(Guid id, Wire wire) { if (!WireDict.ContainsKey(id)) { WireDict.Add(id, new List <Wire>()); } WireDict[id].Add(wire); }
protected int AddChip(Chip chip) { Chips.Add(chip); if (!WireDict.ContainsKey(chip.ID)) { WireDict.Add(chip.ID, new List <Wire>()); } return(Chips.Count - 1); }
protected int AddGate(Gate gate) { Gates.Add(gate); if (!WireDict.ContainsKey(gate.ID)) { WireDict.Add(gate.ID, new List <Wire>()); } return(Gates.Count - 1); }
protected Chip AddChipIndexed(Chip chip) { Chips.Add(chip); if (!WireDict.ContainsKey(chip.ID)) { WireDict.Add(chip.ID, new List <Wire>()); } chip.index = Chips.Count - 1; return(chip); }
protected Gate AddGateIndexed(Gate gate) { Gates.Add(gate); if (!WireDict.ContainsKey(gate.ID)) { WireDict.Add(gate.ID, new List <Wire>()); } gate.index = Gates.Count - 1; return(gate); }