コード例 #1
0
 public string Interpret()
 {
     return(_course.Interpret() +
            _speed.Interpret() +
            _movement.Interpret() +
            _voyage.Interpret());
 }
コード例 #2
0
        public string Interpret(string instruction)
        {
            string[] instrucs = instruction.Split(';');

            foreach (var word in instrucs)
            {
                if (word.Trim() == "")
                {
                    break;
                }
                string[] words = word.Split(' ');

                _instruction = new Instruction(new Course(double.Parse(words[0])),
                                               new Speed(double.Parse(words[1])),
                                               new Movement(words[2]),
                                               new Voyage(double.Parse(words[3])));

                if (_word == null)
                {
                    _word = _instruction;
                }
                else
                {
                    _word = new Semicolon(_word, _instruction);
                }
            }

            return(_word.Interpret());
        }
コード例 #3
0
 public string Interpret()
 {
     return(_left.Interpret() + Environment.NewLine + _right.Interpret());
 }