public void InsertPlugCable(PlugCable plugCable) { if (KeyAlreadyUsedByPlugCable(plugCable)) { throw new PlugboardConfigurationException("Key already specified in existing configuration."); } PlugCableConfiguration.Add(plugCable); }
private bool KeyAlreadyUsedByPlugCable(PlugCable plugCable) { var newPlugCable = new Key[] { plugCable.PlugA, plugCable.PlugB }; return(PlugCableConfiguration.Any(x => newPlugCable.Contains(x.PlugA) || newPlugCable.Contains(x.PlugB))); }
public void RemovePlugCable(PlugCable plugCable) { PlugCableConfiguration.Remove(plugCable); }