AbstractedSheep.ShuttleTrackerWorld.Route.Route C# (CSharp) Method

Route() private method

private Route ( int id, string name, List coords ) : System
id int
name string
coords List
return System
        internal Route(int id, string name, List<Coordinate> coords)
        {
            this.Id = id;
            this.Name = name;
            this.coordinates = new List<Coordinate>(coords);
            this.stops = new Dictionary<string, Stop>();
            this.distanceToNextCoord = new List<double>();
            this.shuttles = new Dictionary<int, Shuttle>();
            this.DistanceToNextCoord = this.distanceToNextCoord.AsReadOnly();
            this.Coordinates = this.coordinates.AsReadOnly();
            this.Shuttles = this.shuttles.AsReadOnly<int, Shuttle>();
            this.Stops = this.stops.AsReadOnly<string, Stop>();

            for(int i = 0; i < this.coordinates.Count; i++)
            {
                Coordinate c1, c2;
                if (i == 0)
                    c1 = this.coordinates.Last();
                else
                    c1 = this.coordinates[i - 1];

                c2 = this.coordinates[i];

                this.distanceToNextCoord.Add(c1.DistanceTo(c2));
            }
        }