<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Core.DomainModel;
using Core.DomainServices.RoutingClasses;
using Newtonsoft.Json.Linq;

namespace Infrastructure.AddressServices.Routing
{
    public class SeptimaRouter
    {
        #region Public methods

        private const string CarFerryMode = "2";
        private const string BicycleFerryMode = "3";

       

        /// <summary>
        /// Get routes and alternative routes for the given set of coordinates.
        /// </summary>
        /// <param name="transportType">Type of transport. Car or Bike.</param>
        /// <param name="routeCoordinates"></param>
        /// <exception cref="RouteInformationException">Thrown if no route was returned or no rute was found.</exception>
        /// <returns></returns>
        public IEnumerable<RouteInformation> GetRoute(DriveReportTransportType transportType, IEnumerable<Coordinates> routeCoordinates)
        {
            List<RouteInformation> routes = new List<RouteInformation>();
            HttpWebRequest request = CreateRequest(transportType, routeCoordinates);
            RootRouteObject result = ExecuteAndRead(transportType, request);

            if (result == null)
            {
                var e = new RouteInformationException("No route returned.");
                //Logger.Error("Exception when getting route information", e);
                throw e;
            }

            if (result.status != 0)
            {
                var e = new RouteInformationException("No route found."); ;<commit_msg>SeptimaRouter can now handle status 200<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Core.DomainModel;
using Core.DomainServices.RoutingClasses;
using Newtonsoft.Json.Linq;

namespace Infrastructure.AddressServices.Routing
{
    public class SeptimaRouter
    {
        #region Public methods

        private const string CarFerryMode = "2";
        private const string BicycleFerryMode = "3";

       

        /// <summary>
        /// Get routes and alternative routes for the given set of coordinates.
        /// </summary>
        /// <param name="transportType">Type of transport. Car or Bike.</param>
        /// <param name="routeCoordinates"></param>
        /// <exception cref="RouteInformationException">Thrown if no route was returned or no rute was found.</exception>
        /// <returns></returns>
        public IEnumerable<RouteInformation> GetRoute(DriveReportTransportType transportType, IEnumerable<Coordinates> routeCoordinates)
        {
            List<RouteInformation> routes = new List<RouteInformation>();
            HttpWebRequest request = CreateRequest(transportType, routeCoordinates);
            RootRouteObject result = ExecuteAndRead(transportType, request);

            if (result == null)
            {
                var e = new RouteInformationException("No route returned.");
                //Logger.Error("Exception when getting route information", e);
                throw e;
            }


            //From septima 01/09 2016:
            //Routingservices kan forventes senere at returnere status = 200,
            //idet OSRM er gået fra at bruge "C style" exit-koder, til "HTTP Style" status-koder.
            if (result.status != 0 && result.status / 100 == 2)
            {
                var e = new RouteInformationException("No route found."); ;
{'fraction_non_alphanumeric': 0.09635119726339794, 'fraction_numerical': 0.0068415051311288486, 'mean_word_length': 2.4742574257425742, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5896824', 'n_tokens_mistral': 871, 'n_tokens_neox': 840, 'n_words': 260}