示例#1
0
        private Sector GetSimpleSector()
        {
            var stations = new Station[0];
            var id = "SectorId";

            return new Sector(id, stations);
        }
示例#2
0
        private static void Main(string[] args)
        {
            var directory = System.IO.Directory.GetCurrentDirectory();

            var builder = new UndergroundEngine.Builder();

            var stations = new Station[4];

            stations[0] = new Station("Paddington");
            stations[1] = new Station("Marylebone");
            stations[2] = new Station("Edgware Rd");
            stations[3] = new Station("Baker St.");

            var sectorsList = new LinkedList<Sector>();

            sectorsList.AddLast(new Sector("Sector1", new Station[] { stations[0], stations[1] }));
            sectorsList.AddLast(new Sector("Sector2", new Station[] { stations[1], stations[2] }));
            sectorsList.AddLast(new Sector("Sector3", new Station[] { stations[2], stations[3] }));

            var sectors = new Sector[3];
            sectors[0] = new Sector("SectorA", new Station[] { stations[0], stations[1] });
            sectors[1] = new Sector("SectorB", new Station[] { stations[1], stations[2] });
            sectors[2] = new Sector("SectorC", new Station[] { stations[2], stations[3] });

            var line = new Line("Bakerloo", stations, sectors);

            var lines = new Line[1];
            lines[0] = line;

            builder.SetLines(lines);

            var undergroundEngine = builder.Build();

            undergroundEngine.Start();
        }
示例#3
0
        public bool TryInsertRightTrain(Train train)
        {
            lock (RightTrainLocker)
            {
                if (RightTrain != null)
                {
                    return false;
                }

                RightTrain = train;

                RightTrainStation = FirstStation;
            }

            return true;
        }