Ejemplo n.º 1
0
        public TravelRoadmap BuildTravelRoadmap(City initial, City destination)
        {
            TravelRoadmap        travelRoadmap  = new TravelRoadmap(initial, destination);
            List <TransportMode> Modes          = new List <TransportMode>();
            DistanceHelper       distanceHelper = new DistanceHelper();

            if (distanceHelper.GetDistance(initial, destination).Equals(Distance.Short))
            {
                Modes.Add(TransportMode.Foot);
                Modes.Add(TransportMode.Car);
                Modes.Add(TransportMode.Train);
                travelRoadmap.Modes = Modes;
            }
            else if (distanceHelper.GetDistance(initial, destination).Equals(Distance.Medium))
            {
                Modes.Add(TransportMode.Plane);
                Modes.Add(TransportMode.Car);
                Modes.Add(TransportMode.Train);
                travelRoadmap.Modes = Modes;
            }
            else
            {
                Modes.Add(TransportMode.Boat);
                Modes.Add(TransportMode.Plane);
                travelRoadmap.Modes = Modes;
            }

            return(travelRoadmap);
        }
Ejemplo n.º 2
0
        public TravelRoadmap BuildTravelRoadmap(City initial, City destination)
        {
            DistanceHelper dh = new DistanceHelper();
            Distance       d  = dh.GetDistance(initial, destination);

            List <TransportMode> transports;

            if (d == Distance.Short)
            {
                transports = new List <TransportMode> {
                    TransportMode.Foot, TransportMode.Car, TransportMode.Train
                };
            }
            else if (d == Distance.Medium)
            {
                transports = new List <TransportMode> {
                    TransportMode.Plane, TransportMode.Car, TransportMode.Train
                };
            }
            else
            {
                transports = new List <TransportMode> {
                    TransportMode.Plane, TransportMode.Boat
                };
            }
            return(new TravelRoadmap {
                Modes = transports
            });
        }
Ejemplo n.º 3
0
        public TravelRoadmap BuildTravelRoadmap(City initial, City destination)
        {
            TravelRoadmap        travelRoadmap = new TravelRoadmap();
            List <TransportMode> listModes     = new List <TransportMode>();

            DistanceHelper distanceHelper = new DistanceHelper();

            switch (distanceHelper.GetDistance(initial, destination))
            {
            case Distance.Short:
                listModes.Add(TransportMode.Foot);
                listModes.Add(TransportMode.Car);
                listModes.Add(TransportMode.Train);
                break;

            case Distance.Medium:
                listModes.Add(TransportMode.Car);
                listModes.Add(TransportMode.Train);
                listModes.Add(TransportMode.Plane);
                break;

            case Distance.Long:
                listModes.Add(TransportMode.Boat);
                listModes.Add(TransportMode.Plane);
                break;
            }

            travelRoadmap.Modes = listModes;

            return(travelRoadmap);
        }
Ejemplo n.º 4
0
        public TravelRoadmap BuildTravelRoadmap(City initial, City destination)
        {
            var distanceHelper = new DistanceHelper();

            var distance = distanceHelper.GetDistance(initial, destination);

            switch (distance)
            {
            case Distance.Short:
                return(new TravelRoadmap
                {
                    Modes = new List <TransportMode> {
                        TransportMode.Foot, TransportMode.Car, TransportMode.Train
                    }
                });

            case Distance.Medium:
                return(new TravelRoadmap
                {
                    Modes = new List <TransportMode> {
                        TransportMode.Car, TransportMode.Train, TransportMode.Plane
                    }
                });

            case Distance.Long:
                return(new TravelRoadmap
                {
                    Modes = new List <TransportMode> {
                        TransportMode.Boat, TransportMode.Plane
                    }
                });
            }

            return(null);
        }