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); }
public virtual City Interpret() { var resultingCity = new City(@"Nowhere", 999.9, 999.9); foreach (var currentExpression in _expressions) { var currentCity = currentExpression.Interpret(); if (currentCity.Longitude < resultingCity.Longitude) { resultingCity = currentCity; } } return resultingCity; }
public CityExpression(City city) { _city = city; }