public static IEnumerable<Plan> ReadAll(TextReader reader, Attractions attractions) { // Read the attraction queries. var count = reader.ReadLineAsync().Result.ParseInteger().VerifyQueryCount(); while (count-- > 0) yield return ReadOne(reader, attractions); }
private static Plan ReadOne(TextReader reader, Attractions attractions) { var count = reader.ReadLineAsync().Result .ParseInteger().VerifyDestinationCount(attractions); var destinations = from a in reader.ReadLineAsync().Result.Split(' ') select a.ParseInteger().VerifyDestination(attractions); // ReSharper disable once PossibleMultipleEnumeration destinations.Count().VerifyValue(count); // ReSharper disable once PossibleMultipleEnumeration return new Plan(attractions, destinations); }
public Route(Attractions attractions, int current, int destination) { _attractions = attractions; Current = current; Destination = destination; }
public Plan(Attractions attractions, IEnumerable<int> destinations) { _attractions = attractions; Destinations = destinations.ToList(); }
protected override void Read(TextReader reader) { _attractions = Attractions.Read(reader); _plans = Plan.ReadAll(reader, _attractions).ToList(); }