Beispiel #1
0
        public RunningSpeed(RunningLog prev, RunningLog next)
        {
            Second = (next.Hour - prev.Hour) * 3600 + (next.Min - prev.Min) * 60 + (next.Sec - prev.Sec) + (next.MiliSec - prev.MiliSec) / 100;
            var distance = next.Distance - prev.Distance;

            Speed = distance / Second * 3600 / 1000;
            if (IsMidnight.Judg(prev, next))
            {
                Second *= 1.25;
            }

            if (Second < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #2
0
        public RunningDistance(RunningLog prev, RunningLog next)
        {
            if (IsMidnight.Judg(prev, next))
            {
                Distance  = next.Distance - prev.Distance;
                Distance *= 1.25;
            }
            else
            {
                Distance = next.Distance - prev.Distance;
            }

            if (Distance < 0.1)
            {
                throw new ArgumentOutOfRangeException();
            }
        }
Beispiel #3
0
        public List <RunningLog> Parse()
        {
            var output = new List <RunningLog>();

            var first = new RunningLog(Console.ReadLine());

            if (first.Distance != 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            output.Add(first);

            while (true)
            {
                var input = Console.ReadLine();
                if (input.Equals(String.Empty))
                {
                    break;
                }
                output.Add(new RunningLog(input));
            }

            return(output);
        }