public void addLink(LinkStation linkStation) { if (links.Contains(linkStation) || hasLink(linkStation.getType(), linkStation.getA(), linkStation.getB())) { throw new ApplicationException("Данная связь уже установлена"); } links.Add(linkStation); }
public void removeLink(LinkStation linkStation) { RattlerTransportType type = linkStation.getType(); if (!allLinks.ContainsKey(type)) { return; } allLinks[type].Remove(linkStation); }
public void addLink(LinkStation linkStation) { RattlerTransportType type = linkStation.getType(); List <LinkStation> links; if (allLinks.ContainsKey(type)) { links = allLinks[type]; } else { links = new List <LinkStation>(); allLinks[type] = links; } if (links.Contains(linkStation) || hasLink(type, linkStation.getA(), linkStation.getB())) { throw new ApplicationException("Данная связь уже установлена"); } links.Add(linkStation); }