Beispiel #1
0
        private void InsertSite(SiteEvent site)
        {
            var newArcA = new Arc {
                Site = site, LeftNeighbour = site
            };
            var newArcB = new Arc {
                Site = site, LeftNeighbour = site
            };

            var newNodeA      = InsertIntoSkiplist(newArcA);
            var newNodeB      = InsertIntoSkiplist(newArcB);
            var neighbourhood = FindNeighbourhoodOf(newNodeA);

            neighbourhood[3].Site = neighbourhood[1].Site;

            neighbourhood[1].LeftNeighbour = neighbourhood[0].Site;
            neighbourhood[2].LeftNeighbour = neighbourhood[1].Site;
            neighbourhood[3].LeftNeighbour = neighbourhood[2].Site;
            neighbourhood[4].LeftNeighbour = neighbourhood[3].Site;

            PotentialCircleEvents.Add(new CircleEvent(neighbourhood[0], neighbourhood[1], neighbourhood[2]));
            PotentialCircleEvents.Add(new CircleEvent(neighbourhood[2], neighbourhood[3], neighbourhood[4]));

            NewArcs.Add(new List <IArc> {
                neighbourhood[2], neighbourhood[3]
            });
        }
Beispiel #2
0
        public void Remove(IArc arc)
        {
            var node = _arcs.Remove(arc);

            if (node == null)
            {
                throw new DataException("Failed to remove arc " + arc);
            }
            node.Right.Key.LeftNeighbour = node.Left.Key.Site;
            Count--;

            PotentialCircleEvents.Add(new CircleEvent(node.Left.Left.Key, node.Left.Key, node.Right.Key));
            PotentialCircleEvents.Add(new CircleEvent(node.Left.Key, node.Right.Key, node.Right.Right.Key));
        }