private WeatherData GetInfo()
        {
            PastWeather pastWeather = null;
            WeatherData data        = new WeatherData();
            // set input parameters for the API
            LocalWeatherInput input = new LocalWeatherInput();

            input.query       = m_info_future.query;
            input.num_of_days = m_info_future.num_of_days;
            input.date        = m_info_future.date;
            input.format      = "JSON";

            // call the local weather method with input parameters
            OpenWeatherAPI api          = new OpenWeatherAPI();
            LocalWeather   localWeather = api.GetLocalWeather(input);


            //set data in datastore based on which kind of datastore refresh was requested
            if (m_reftype == RefreshType.AddLeft)
            {
                DataStore.Instance().AddLeft(pastWeather);
            }
            else if (m_reftype == RefreshType.AddLeft)
            {
                DataStore.Instance().AddRight(localWeather);
            }
            else
            {
                DataStore.Instance().SetWeather(localWeather, pastWeather);
            }

            return(data);
        }
        /// <summary>
        /// This event handler method calls
        /// the ProcessHistoricalData method of the ProcessorClass class
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void DisplayHistoricalDataButton_Click(object sender, EventArgs e)
        {
            //ProcessorClass.ProcessHistoricalData();
            try
            {
                String           location = SearchTextBox.Text.ToString();
                PastWeatherInput input    = new PastWeatherInput();
                input.query   = location;
                input.date    = "2013-03-01";
                input.enddate = "2018-03-03";
                input.format  = "JSON";

                /* Call the GetPastWeather method and pass in input parameters*/
                API_Implementation api         = new API_Implementation();
                PastWeather        pastWeather = api.GetPastWeather(input);

                /*Display Results*/
                DisplayResultsTextBox.Text  = "\r\n Date: " + pastWeather.data.weather[0].date;
                DisplayResultsTextBox.Text += "\r\n Max Temp(C): " + pastWeather.data.weather[0].maxtempC;
                DisplayResultsTextBox.Text += "\r\n Max Temp(F): " + pastWeather.data.weather[0].maxtempF;
                DisplayResultsTextBox.Text += "\r\n Min Temp(C): " + pastWeather.data.weather[0].mintempC;
                DisplayResultsTextBox.Text += "\r\n Min Temp(F): " + pastWeather.data.weather[0].mintempF;
                DisplayResultsTextBox.Text += "\r\n Cloud Cover: " + pastWeather.data.weather[0].hourly[0].cloudcover;
                DisplayResultsTextBox.Text += "\r\n Humidity: " + pastWeather.data.weather[0].hourly[0].humidity;
                DisplayResultsTextBox.Text += "\r\n Pressure: " + pastWeather.data.weather[0].hourly[0].pressure;
                DisplayResultsTextBox.Text += "\r\n Visibility: " + pastWeather.data.weather[0].hourly[0].visibility;
                DisplayResultsTextBox.Text += "\r\n Wind Speed: " + pastWeather.data.weather[0].hourly[0].windspeedMiles;
            }
            catch (Exception ex)
            {
                ex.GetBaseException();
            }
        }
        public PastWeather GetPastWeather(PastWeatherInput input)
        {
            // create URL based on input paramters
            string apiURL = ApiBaseURL + "past-weather.ashx?q=" + input.query + "&format=" + input.format + "&extra=" + input.extra + "&enddate=" + input.enddate + "&date=" + input.date + "&includelocation=" + input.includelocation + "&callback=" + input.callback + "&key=" + PremiumAPIKey;

            // get the web response
            string result = new RequestHandler(apiURL).Process();

            // deserialize the json output into the c#classes created earlier
            PastWeather pWeather = null;

            if (result != null)
            {
                result = result.Replace("No moonset", "11:47 AM");
            }
            try
            {
                pWeather = (PastWeather) new JavaScriptSerializer().Deserialize(result, typeof(PastWeather));
            }
            catch (FormatException ex)
            {
            }

            return(pWeather);
        }
        /// <summary>
        /// This method consumes the WorldWeather Premium API
        /// to show past weather data of any given location
        /// for a given period
        /// </summary>
        public void GetHistoricalData()
        {
            try
            {
                String           location = SearchTextBox.Text.ToString();
                PastWeatherInput input    = new PastWeatherInput();
                input.query   = location;
                input.date    = "2017-01-01";
                input.enddate = "2019-01-01";
                input.format  = "JSON";

                /* Call the GetPastWeather method and pass in input parameters*/
                API_Implementation api         = new API_Implementation();
                PastWeather        pastWeather = api.GetPastWeather(input);

                /*Display Results*/
                DisplayResultsTextBox.Text  = "\r\n Date: " + pastWeather.data.weather[0].date;
                DisplayResultsTextBox.Text += "\r\n Max Temp(C): " + pastWeather.data.weather[0].maxtempC;
                DisplayResultsTextBox.Text += "\r\n Max Temp(F): " + pastWeather.data.weather[0].maxtempF;
                DisplayResultsTextBox.Text += "\r\n Min Temp(C): " + pastWeather.data.weather[0].mintempC;
                DisplayResultsTextBox.Text += "\r\n Min Temp(F): " + pastWeather.data.weather[0].mintempF;
                DisplayResultsTextBox.Text += "\r\n Cloud Cover: " + pastWeather.data.weather[0].hourly[0].cloudcover;
            }
            catch (Exception ex) {
                ex.GetBaseException();
            }
        }
Exemple #5
0
        /// <summary>
        /// This method gets the historical
        /// weather data of a given location
        /// for a given period of time
        /// </summary>
        /// <param name="input"></param>
        /// <returns>weather history</returns>
        public PastWeather GetPastWeather(PastWeatherInput input)
        {
            /* Create URL based on input paramters */
            string apiURL = ApiBaseURL + "past-weather.ashx?q=" + input.query + "&format=" + input.format + "&extra=" + input.extra + "&enddate=" + input.enddate + "&date=" + input.date + "&includelocation=" + input.includelocation + "&callback=" + input.callback + "&key=" + APIKey;

            /* Get the web response */
            string result = RequestHandler.Process(apiURL);

            /* Serialize the json output and parse in the helper class */
            PastWeather pWeather = (PastWeather) new JavaScriptSerializer().Deserialize(result, typeof(PastWeather));

            return(pWeather);
        }
Exemple #6
0
        /// <summary>
        /// Adds information to the left of Linked list. ie if we want to fetch historical data far into the past
        /// </summary>
        /// <param name="future"></param>
        public void AddLeft(PastWeather past)
        {
            lock (accesssynch)
            {
                if (m_start == null || past.data.weather == null)//we cant recover from this situation
                {
                    HandleError();
                    return;
                }
                List <premium.pastweather.Weather> pastweathers = past.data.weather;
                Node first = null;
                Node last  = null;
                foreach (premium.pastweather.Weather weather in pastweathers)
                {
                    WeatherData data = fillDataPast(weather);
                    data.m_location = past.data.request[0].query;

                    //Todo: determine this value
                    data.m_rainchance = 0;
                    Node node = new Node();
                    node.data     = data;
                    node.datetime = data.m_date;
                    if (first == null)
                    {
                        first = node;
                        last  = first;
                    }
                    else
                    {
                        last.next = node;
                        node.prev = last;
                        last      = node;
                    }
                }

                last.next    = m_start;
                m_start.prev = last;
                m_start      = first;
                moveleft();
            }
        }
Exemple #7
0
        public ActionResult Index()
        {
            #region Weather

            #region Current
            string Miasto = "Limanowa";

            if (!Request["Wybrane_miasto"].IsEmpty())
            {
                Miasto = Request["Wybrane_miasto"];
            }



            weatherInfo.WeatherInfo.root checkWeather = new WeatherInfo.root();
            weather weather = new weather();

            checkWeather = weather.DownloadWeather(Miasto);



            bool sprawdz = true;
            if (checkWeather != null)
            {
                sprawdz = true;
                // lastweather.SaveWeather(checkWeather);
                ViewBag.weatherName      = checkWeather.name;
                ViewBag.weatherCountry   = checkWeather.sys.country;
                ViewBag.weatherTemp      = checkWeather.main.temp.ToString();
                ViewBag.weatherfeelsLike = checkWeather.main.feels_like.ToString();
                ViewBag.weatherTempMax   = checkWeather.main.temp_max.ToString();
                ViewBag.weatherTempMin   = checkWeather.main.temp_min.ToString();
                ViewBag.weatherPressure  = checkWeather.main.pressure.ToString();
                ViewBag.weatherHumidity  = checkWeather.main.humidity.ToString();
                ViewBag.weatherWindSpeed = checkWeather.wind.speed.ToString();
            }
            else
            {
                sprawdz       = false;
                ViewBag.error = "Brak miasta " + Miasto + " w bazie danych";
            }

            #endregion

            #region Historia

            weatherInfo.HistoriWeatherInfo.root yeasterdayweater = new weatherInfo.HistoriWeatherInfo.root();
            PastWeather pastWeather = new PastWeather();

            UnixTime wczorajTime = new UnixTime();
            int      time        = wczorajTime.WczorajUnixTime();

            int dtNow = 15;

            if (sprawdz == true)
            {
                yeasterdayweater = pastWeather.DownloandLastWeather(checkWeather.coord.lat, checkWeather.coord.lon, time);
                //dtNow = pastWeather.ActualTime(yeasterdayweater);
            }
            if (yeasterdayweater.hourly != null && dtNow != -1)
            {
                ViewBag.yeasterdayWeaterTemp = yeasterdayweater.hourly[dtNow].temp;
                if (checkWeather.main.temp > yeasterdayweater.hourly[dtNow].temp)
                {
                    int    one = (int)((checkWeather.main.temp - yeasterdayweater.hourly[dtNow].temp) * 100);
                    double two = (double)one / 100;

                    ViewBag.yeasterdayDifferenceTempInt    = two;
                    ViewBag.yeasterdayDifferenceTempString = "cieplej ";
                }
                else if (checkWeather.main.temp < yeasterdayweater.hourly[dtNow].temp)
                {
                    int    one = (int)((yeasterdayweater.hourly[dtNow].temp - checkWeather.main.temp) * 100);
                    double two = (double)one / 100;

                    ViewBag.yeasterdayDifferenceTempInt    = two;
                    ViewBag.yeasterdayDifferenceTempString = "zimniej ";
                }

                ViewBag.yeasterdayWeaterfeelslike = yeasterdayweater.hourly[dtNow].feels_like;
                if (checkWeather.main.feels_like > yeasterdayweater.hourly[dtNow].feels_like)
                {
                    int    one = (int)((checkWeather.main.feels_like - yeasterdayweater.hourly[dtNow].feels_like) * 100);
                    double two = (double)one / 100;

                    ViewBag.yeasterdayDifferencefeelslikeInt    = two;
                    ViewBag.yeasterdayDifferencefeelslikeString = "cieplej ";
                }
                else if (checkWeather.main.feels_like < yeasterdayweater.hourly[dtNow].feels_like)
                {
                    int    one = (int)((yeasterdayweater.hourly[dtNow].feels_like - checkWeather.main.feels_like) * 100);
                    double two = (double)one / 100;

                    ViewBag.yeasterdayDifferencefeelslikeint    = two;
                    ViewBag.yeasterdayDifferencefeelslikeString = "zimniej ";
                }

                ViewBag.yeasterdayWeaterPressure = yeasterdayweater.hourly[dtNow].pressure;
                if (checkWeather.main.pressure > yeasterdayweater.hourly[dtNow].pressure)
                {
                    ViewBag.yeasterdayDifferencePressureInt    = checkWeather.main.pressure - yeasterdayweater.hourly[dtNow].pressure;
                    ViewBag.yeasterdayDifferencePressureString = "wyższe";
                }
                else if (checkWeather.main.pressure < yeasterdayweater.hourly[dtNow].pressure)
                {
                    ViewBag.yeasterdayDifferencePressureInt    = yeasterdayweater.hourly[dtNow].pressure - checkWeather.main.pressure;
                    ViewBag.yeasterdayDifferencePressureString = "niższe";
                }

                ViewBag.yeasterdayWeaterHumidity = yeasterdayweater.hourly[dtNow].humidity;
                if (checkWeather.main.humidity > yeasterdayweater.hourly[dtNow].humidity)
                {
                    ViewBag.yeasterdayDifferenceHumidityInt    = checkWeather.main.humidity - yeasterdayweater.hourly[dtNow].humidity;
                    ViewBag.yeasterdayDifferenceHumidityString = "wyższe";
                }
                else if (checkWeather.main.humidity < yeasterdayweater.hourly[dtNow].humidity)
                {
                    ViewBag.yeasterdayDifferenceHumidityInt    = yeasterdayweater.hourly[dtNow].humidity - checkWeather.main.humidity;
                    ViewBag.yeasterdayDifferenceHumidityString = "niższe";
                }

                ViewBag.yeasterdayWeaterWeaterWindSpeed = yeasterdayweater.hourly[dtNow].wind_speed;
                if (checkWeather.wind.speed > yeasterdayweater.hourly[dtNow].wind_speed)
                {
                    ViewBag.yeasterdayDifferenceWindSpeedInt    = checkWeather.wind.speed - yeasterdayweater.hourly[dtNow].wind_speed;
                    ViewBag.yeasterdayDifferenceWindSpeedString = "mocniejszy";
                }
                else if (checkWeather.wind.speed < yeasterdayweater.hourly[dtNow].wind_speed)
                {
                    ViewBag.yeasterdayDifferenceWindSpeedInt    = yeasterdayweater.hourly[dtNow].wind_speed - checkWeather.wind.speed;
                    ViewBag.yeasterdayDifferenceWindSpeedString = "słabszy";
                }
            }
            else
            {
                ViewBag.lastError = "Nie udało się pobrać danych wczorajszego dnia";
            }
            #endregion

            #region Prognoza


            FutureWeatherInfo.root futureWeather = new FutureWeatherInfo.root();
            FutureWeather          dowloand      = new FutureWeather();

            UnixTime unixTime = new UnixTime();



            if (sprawdz == true)
            {
                futureWeather = dowloand.DownloandFutureWeather(checkWeather.coord.lat, checkWeather.coord.lon);
                Nazwa_Miasta  = checkWeather.name;
                publicLat     = checkWeather.coord.lat;
                publicLon     = checkWeather.coord.lon;
            }
            if (futureWeather.daily != null)
            {
                ViewBag.futureWeatherTemp = futureWeather.daily[0].temp.day;
                if (checkWeather.main.temp > futureWeather.daily[0].temp.day)
                {
                    int    one = (int)((checkWeather.main.temp - futureWeather.daily[0].temp.day) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempInt    = two;
                    ViewBag.futureDifferenceTempString = "zimniej ";
                }
                else if (checkWeather.main.temp < futureWeather.daily[0].temp.day)
                {
                    int    one = (int)((futureWeather.daily[0].temp.day - checkWeather.main.temp) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempInt    = two;
                    ViewBag.futureDifferenceTempString = "cieplej ";
                }

                ViewBag.futureWeatherTempMax = futureWeather.daily[0].temp.max;
                if (checkWeather.main.temp_max > futureWeather.daily[0].temp.max)
                {
                    int    one = (int)((checkWeather.main.temp_max - futureWeather.daily[0].temp.max) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempMaxInt    = two;
                    ViewBag.futureDifferenceTempMaxString = "zimniej";
                }
                else if (checkWeather.main.temp_max < futureWeather.daily[0].temp.max)
                {
                    int    one = (int)((futureWeather.daily[0].temp.max - checkWeather.main.temp_max) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempMaxInt    = two;
                    ViewBag.futureDifferenceTempMaxString = "cieplej";
                }

                ViewBag.futureWeatherTempMin = futureWeather.daily[0].temp.min;
                if (checkWeather.main.temp_min > futureWeather.daily[0].temp.min)
                {
                    int    one = (int)((checkWeather.main.temp_min - futureWeather.daily[0].temp.min) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempMinInt    = two;
                    ViewBag.futureDifferenceTempMinString = "zimniej ";
                }
                else if (checkWeather.main.temp_min > futureWeather.daily[0].temp.min)
                {
                    int    one = (int)((futureWeather.daily[0].temp.min - checkWeather.main.temp_min) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceTempMinInt    = two;
                    ViewBag.futureDifferenceTempMinString = "cieplej ";
                }

                ViewBag.futureWeatherFeelsLike = futureWeather.daily[0].feels_Like.day;
                if (checkWeather.main.feels_like > futureWeather.daily[0].feels_Like.day)
                {
                    int    one = (int)((checkWeather.main.feels_like - futureWeather.daily[0].feels_Like.day) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceFeelsLikeInt    = two;
                    ViewBag.futureDifferenceFeelsLikeString = "zimniej ";
                }
                else if (checkWeather.main.feels_like < futureWeather.daily[0].feels_Like.day)
                {
                    int    one = (int)((futureWeather.daily[0].feels_Like.day - checkWeather.main.feels_like) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceFeelsLikeInt    = two;
                    ViewBag.futureDifferenceFeelsLikeString = "cieplej ";
                }

                ViewBag.futureWeatherPressure = futureWeather.daily[0].pressure;
                if (checkWeather.main.pressure > futureWeather.daily[0].pressure)
                {
                    int    one = (int)((checkWeather.main.pressure - futureWeather.daily[0].pressure) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferencePressureInt    = two;
                    ViewBag.futureDifferencePressureString = "niższe ";
                }
                else if (checkWeather.main.pressure < futureWeather.daily[0].pressure)
                {
                    int    one = (int)((futureWeather.daily[0].pressure - checkWeather.main.pressure) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferencePressureInt    = two;
                    ViewBag.futureDifferencePressureString = "wyższe ";
                }

                ViewBag.futureWeatherHumidity = futureWeather.daily[0].humidity;
                if (checkWeather.main.humidity > futureWeather.daily[0].humidity)
                {
                    int    one = (int)((checkWeather.main.humidity - futureWeather.daily[0].humidity) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceHumidityInt    = two;
                    ViewBag.futureDifferenceHumidityString = "niższe ";
                }
                else if (checkWeather.main.humidity < futureWeather.daily[0].humidity)
                {
                    int    one = (int)((futureWeather.daily[0].humidity - checkWeather.main.humidity) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceHumidityInt    = two;
                    ViewBag.futureDifferenceHumidityString = "wyższe ";
                }

                ViewBag.futureWeatherWindSpeed = futureWeather.daily[0].wind_speed;
                if (checkWeather.wind.speed > futureWeather.daily[0].wind_speed)
                {
                    int    one = (int)((checkWeather.wind.speed - futureWeather.daily[0].wind_speed) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceWindSpeedInt    = two;
                    ViewBag.futureDifferenceWindSpeedString = "słabszy ";
                }
                else if (checkWeather.wind.speed < futureWeather.daily[0].wind_speed)
                {
                    int    one = (int)((futureWeather.daily[0].wind_speed - checkWeather.wind.speed) * 100);
                    double two = (double)one / 100;

                    ViewBag.futureDifferenceWindSpeedInt    = two;
                    ViewBag.futureDifferenceWindSpeedString = "mocniejszy ";
                }
            }//szegóły jutrzejszego dnia
            else
            {
                ViewBag.FutureError = "Nie udało się pobrać prognozowanej pogody";
            }
            if (futureWeather.daily != null)
            {
                ViewBag.weatherLon = checkWeather.coord.lon;
                ViewBag.weatherLat = checkWeather.coord.lat;

                string dzień = unixTime.AktualnyDzieńString(futureWeather.daily[0].dt);


                ViewBag.futureWeatherOneDay  = dzień;
                ViewBag.futureWeatherOneTemp = futureWeather.daily[0].temp.day;
                ViewBag.futureWeatherOnePop  = futureWeather.daily[0].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[1].dt);
                ViewBag.futureWeatherTwoDay  = dzień;
                ViewBag.futureWeatherTwoTemp = futureWeather.daily[1].temp.day;
                ViewBag.futureWeatherTwoPop  = futureWeather.daily[1].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[2].dt);
                ViewBag.futureWeatherThreeDay  = dzień;
                ViewBag.futureWeatherThreeTemp = futureWeather.daily[2].temp.day;
                ViewBag.futureWeatherThreePop  = futureWeather.daily[2].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[3].dt);
                ViewBag.futureWeatherFourDay  = dzień;
                ViewBag.futureWeatherFourTemp = futureWeather.daily[3].temp.day;
                ViewBag.futureWeatherFourPop  = futureWeather.daily[3].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[4].dt);
                ViewBag.futureWeatherFiveDay  = dzień;
                ViewBag.futureWeatherFiveTemp = futureWeather.daily[4].temp.day;
                ViewBag.futureWeatherFivePop  = futureWeather.daily[4].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[5].dt);
                ViewBag.futureWeatherSixDay  = dzień;
                ViewBag.futureWeatherSixTemp = futureWeather.daily[5].temp.day;
                ViewBag.futureWeatherSixPop  = futureWeather.daily[5].pop * 100;


                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[6].dt);
                ViewBag.futureWeatherSevenDay  = dzień;
                ViewBag.futureWeatherSevenTemp = futureWeather.daily[6].temp.day;
                ViewBag.futureWeatherSevenPop  = futureWeather.daily[6].pop * 100;

                dzień = unixTime.AktualnyDzieńString(futureWeather.daily[7].dt);
                ViewBag.futureWeatherEightDay  = dzień;
                ViewBag.futureWeatherEightTemp = futureWeather.daily[7].temp.day;
                ViewBag.futureWeatherEightPop  = futureWeather.daily[7].pop * 100;
            } //Szybka probnoza na 8 dni

            #endregion

            #endregion


            return(View());
        }
Exemple #8
0
        /// <summary>
        /// Main interface to set weather information to be used later.
        /// If input is valid, we clear all current data and set new data
        /// </summary>
        /// <param name="future"></param>
        /// <param name="past"></param>
        public void SetWeather(LocalWeather future, PastWeather past = null)
        {
            lock (accesssynch)
            {
                if (future == null || future.data == null || future.data.weather == null)
                {
                    HandleError();
                    return;
                }
                Clear();
                if (past != null)//for historical data
                {
                    List <premium.pastweather.Weather> pastweathers = past.data.weather;
                    foreach (premium.pastweather.Weather weather in pastweathers)
                    {
                        //create input to usable and storable weatherdata object
                        WeatherData data = fillDataPast(weather);
                        data.m_location = past.data.request[0].query;


                        data.m_rainchance = 0;
                        //Create a doubly Linked list chain to store weather of each date
                        Node node = new Node();
                        node.data     = data;
                        node.datetime = data.m_date;
                        if (m_start == null)
                        {
                            m_start = node;
                            m_left  = node;
                        }
                        else
                        {
                            m_end.next = node;
                            node.prev  = m_end;
                        }
                        m_right = node;
                        m_end   = node;
                    }
                }
                if (future.data.weather != null)//for future data
                {
                    List <premium.localweather.Weather> localweathers = future.data.weather;
                    foreach (premium.localweather.Weather weather in localweathers)
                    {
                        WeatherData data = fillDataFuture(weather);
                        data.m_location = future.data.request[0].query;
                        //Create a doubly Linked list chain to store weather of each date
                        Node node = new Node();
                        node.data     = data;
                        node.datetime = data.m_date;
                        if (m_today == null)
                        {
                            m_today = node;
                        }
                        if (m_start == null)
                        {
                            m_start = node;
                            m_left  = node;
                        }
                        else
                        {
                            m_end.next = node;
                            node.prev  = m_end;
                        }
                        m_right = node;
                        m_end   = node;
                    }
                }
            }
        }