Пример #1
0
            private void OnAddRoute(IRoute route)
            {
                if (_betterRoutes.First == null)
                {
                    _betterRoutes.AddFirst(route);
                }
                else
                {
                    var rLinesCnt = route.GetLines().Count();

                    var currentNode = _betterRoutes.First;
                    do
                    {
                        var cLinesCnt = currentNode.Value.GetLines().Count();
                        if (rLinesCnt > cLinesCnt)
                        {
                            _betterRoutes.AddBefore(currentNode, route);
                            break;
                        }
                        else if (rLinesCnt == cLinesCnt)
                        {
                            if (currentNode.Value.Timespan > route.Timespan)
                            {
                                _betterRoutes.AddBefore(currentNode, route);
                                break;
                            }
                        }
                        currentNode = currentNode.Next;
                    }while (currentNode != null);
                    if (currentNode == null)
                    {
                        _betterRoutes.AddLast(route);
                    }
                }
            }
Пример #2
0
 protected virtual void OnAddRoute(IRoute route)
 {
     Timespan += route.Timespan;
     Length   += route.Length - 1;
     Lines.UnionWith(route.GetLines());
 }