Example #1
0
        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);
        }
Example #2
0
        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);
        }
Example #3
0
 public void addLink(LinkStation linkStation)
 {
     if (links.Contains(linkStation) || hasLink(linkStation.getType(), linkStation.getA(), linkStation.getB()))
     {
         throw new ApplicationException("Данная связь уже установлена");
     }
     links.Add(linkStation);
 }
Example #4
0
 public void removeLink(LinkStation linkStation)
 {
     linkStation.getA().removeLink(linkStation);
     linkStation.getB().removeLink(linkStation);
     core.store.links.Remove(linkStation);
 }