Пример #1
0
        public static void Get(DataAnalyzer pDA, string entry)
        {
            string[] segments = entry.Split(' ');
            string subcommand = segments[1].ToUpper();
            double returned = -1;

            switch (subcommand)
            {
                #region Internal

                case "VELOCITY":
                case "V":
                    if (segments.Count() < 4)
                    {
                        Console.Write("Distance and Time not entered.");
                    }
                    else
                    {
                        Console.Write("Velocity = distance/time = {0}/{1} = ", segments[2], segments[3]);
                        returned = pDA.Velocity(double.Parse(segments[2]), double.Parse(segments[3]));
                        Console.WriteLine(returned);
                    }
                    break;

                case "ACCELERATION":
                case "A":
                    if (segments.Count() < 5)
                    {
                        Console.Write("Distance and Time not entered.");
                    }
                    else if (segments.Count() == 5)
                    {
                        Console.Write("Acceleration = (v2 - v1)/time = ({1} - {0})/{2} = ", segments[2], segments[3], segments[4]);
                        returned = pDA.Acceleration(double.Parse(segments[2]), double.Parse(segments[3]), double.Parse(segments[4]));
                        Console.WriteLine(returned);
                    }
                    else if (segments.Count() > 5)
                    {
                        Console.Write("Acceleration = (v2 - v1)/time = ({2}/{3} - {0}/{1})/{3} = ", segments[2], segments[3], segments[4], segments[5]);
                        returned = pDA.Acceleration(double.Parse(segments[2]), double.Parse(segments[3]), double.Parse(segments[4]), double.Parse(segments[5]));
                        Console.WriteLine(returned);
                    }
                    break;

                #endregion

                #region Private

                case "I":
                    returned = pDA.GetI();
                    Console.WriteLine("i = " + returned);
                    break;

                case "N":
                    returned = pDA.GetN();
                    Console.WriteLine("n = " + returned);
                    break;

                case "MAX":
                    returned = pDA.GetMax();
                    Console.WriteLine("max = " + returned);
                    break;

                case "STARTELEVATION":
                case "SE":
                    returned = pDA.GetStartElevation();
                    Console.WriteLine("Start Elevation = " + returned);
                    break;

                case "STARTLATITUDE":
                case "SLAT":
                    returned = pDA.GetStartLatitude();
                    Console.WriteLine("Start Latitude = " + returned);
                    break;

                case "STARTLONGITUDE":
                case "SLON":
                    returned = pDA.GetStartLongitude();
                    Console.WriteLine("Start Longitude = " + returned);
                    break;

                case "STARTDATETIME":
                case "SD":
                    Console.WriteLine("Start Date Time = " + pDA.GetStartDateTime());
                    break;

                case "ENDELEVATION":
                case "EE":
                    returned = pDA.GetEndElevation();
                    Console.WriteLine("End Elevation = " + returned);
                    break;

                case "ENDLATITUDE":
                case "ELAT":
                    returned = pDA.GetEndLatitude();
                    Console.WriteLine("End Latitude = " + returned);
                    break;

                case "ENDLONGITUDE":
                case "ELON":
                    returned = pDA.GetEndLongitude();
                    Console.WriteLine("End Longitude = " + returned);
                    break;

                case "ENDDATETIME":
                case "ED":
                    Console.WriteLine("End Date Time = " + pDA.GetEndDateTime());
                    break;

                case "DISTANCES":
                case "DS":
                    Console.WriteLine("Distances:");
                    Console.WriteLine(pDA.GetDistances());
                    break;

                case "FLATDISTANCES":
                case "FDS":
                    Console.WriteLine("Flat Distances:");
                    Console.WriteLine(pDA.GetFlatDistances());
                    break;

                case "VERTICALDISTANCES":
                case "VDS":
                    Console.WriteLine("Vertical Distances:");
                    Console.WriteLine(pDA.GetVerticalDistances());
                    break;

                case "VELOCITIES":
                case "VS":
                    Console.WriteLine("Velocities:");
                    Console.WriteLine(pDA.GetVelocities());
                    break;

                case "FLATVELOCITIES":
                case "FVS":
                    Console.WriteLine("Flat Velocities:");
                    Console.WriteLine(pDA.GetFlatVelocities());
                    break;

                case "VERTICALVELOCITIES":
                case "VVS":
                    Console.WriteLine("Vertical Velocities:");
                    Console.WriteLine(pDA.GetVerticalVelocities());
                    break;

                case "COURSES":
                case "CS":
                    Console.WriteLine("Courses:");
                    Console.WriteLine(pDA.GetCourses());
                    break;

                case "TIMES":
                case "TS":
                    Console.WriteLine("Times:");
                    Console.WriteLine(pDA.GetTimes());
                    break;

                #endregion

                #region Common

                case "TOTALDISTANCE":
                case "TD":
                    returned = pDA.GetTotalDistance();
                    Console.WriteLine("Total Distance = " + returned);
                    break;

                case "AVERAGEDISTANCE":
                case "AD":
                    returned = pDA.GetAverageDistance();
                    Console.WriteLine("Average Distance = " + returned);
                    break;

                case "TOTALTIME":
                case "TT":
                    returned = pDA.GetTotalTime();
                    Console.WriteLine("Total Distance = " + returned);
                    break;

                case "AVERAGETIME":
                case "AT":
                    returned = pDA.GetAverageTime();
                    Console.WriteLine("Average Distance = " + returned);
                    break;

                case "AVERAGEVELOCITY":
                case "AV":
                    returned = pDA.GetAverageVelocity();
                    Console.WriteLine("Total Distance = " + returned);
                    break;

                case "MAXVELOCITY":
                case "MV":
                    returned = pDA.GetMaxVelocity();
                    Console.WriteLine("Average Distance = " + returned);
                    break;

                case "MINIMUMELEVATION":
                case "MINELEVATION":
                case "MINELE":
                case "MNE":
                    returned = pDA.GetMinElevation();
                    Console.WriteLine("Total Distance = " + returned);
                    break;

                case "MAXIMUMELEVATION":
                case "MAXELEVATION":
                case "MAXELE":
                case "MXE":
                    returned = pDA.GetMaxElevation();
                    Console.WriteLine("Average Distance = " + returned);
                    break;

                default:
                    Console.WriteLine("Function Not Recognized.");
                    break;

                #endregion
            }
        }