コード例 #1
0
        /// <summary>
        /// Will build a noun by adding any adjectives beginning
        /// at the provided idx.
        /// </summary>
        /// <param name="idx"></param>
        /// <returns></returns>
        private Noun GetNounAt(int idx)
        {
            var adjectives = new List <Adjective>();
            var nextArg    = this.Args.Args.ElementAt(idx);

            while (Adjective.IsAdjective(nextArg))
            {
                var adjective = Adjective.Parse(nextArg);
                adjectives.Add(Adjective.Parse(nextArg));
                ++idx;
                nextArg = this.Args.Args.ElementAt(idx);
            }

            var noun = new Noun(nextArg);

            adjectives.ForEach(a => noun.AddAdjective(a));

            return(noun);
        }