public virtual City Interpret()
 {
     City resultingCity = new City("Nowhere", 999.9, 999.9);
     foreach (IExpression currentExpression in expressions)
     {
         City currentCity = currentExpression.Interpret();
         if (currentCity.Latitude < resultingCity.Latitude)
         {
             resultingCity = currentCity;
         }
     }
     return resultingCity;
 }
        public DirectionalEvaluator()
        {
            cities = new Dictionary<string, City>();

            cities["aberdeen"] = new City("Aberdeen", 57.15, -2.15);
            cities["belfast"] = new City("Belfast", 54.62, -5.93);
            cities["birmingham"] = new City("Birmingham", 52.42, -1.92);
            cities["dublin"] = new City("Dublin", 53.33, -6.25);
            cities["edinburgh"] = new City("Edinburgh", 55.92, -3.02);
            cities["glasgow"] = new City("Glasgow", 55.83, -4.25);
            cities["london"] = new City("London", 51.53, -0.08);
            cities["liverpool"] = new City("Liverpool", 53.42, -3.0);
            cities["manchester"] = new City("Manchester", 53.5, -2.25);
            cities["southampton"] = new City("Southampton", 50.9, -1.38);
        }
Example #3
0
 public CityExpression(City city)
 {
     this.city = city;
 }