示例#1
0
文件: Road.cs 项目: Fraham/TrafficApp
        private static Road DecodeName(string roadName)
        {
            Road road;

            if (roadName.StartsWith("M"))
            {
                road = new Motorway(roadName);
            }
            else if (roadName.StartsWith("A"))
            {
                road = new ARoad(roadName);
            }
            else
            {
                road = new Road(roadName);
            }

            return(road);
        }
示例#2
0
文件: Road.cs 项目: Fraham/TrafficApp
        public static Road NewRoad(string roadName)
        {
            Road road;

            if (roadName.StartsWith("M"))
            {
                road = new Motorway(roadName);
            }
            else if (roadName.StartsWith("A"))
            {
                road = new ARoad(roadName);
            }
            else
            {
                road = new Road(roadName);
            }

            Roads.Add(road);
            Save();

            return(road);
        }