public void addLink(LinkStation linkStation) { if (links.Contains(linkStation) || hasLink(linkStation.getType(), linkStation.getA(), linkStation.getB())) { throw new ApplicationException("Данная связь уже установлена"); } links.Add(linkStation); }
public LinkStation addLink(LinkStation linkStation) { RattlerStation A = linkStation.getA(); RattlerStation B = linkStation.getB(); A.addLink(linkStation); try { B.addLink(linkStation); } catch (Exception ex) { A.removeLink(linkStation); throw; } core.store.links.Add(linkStation); return(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); }
public void removeLink(LinkStation linkStation) { linkStation.getA().removeLink(linkStation); linkStation.getB().removeLink(linkStation); core.store.links.Remove(linkStation); }