Ejemplo n.º 1
0
        private static void FullInfo(FamilyTreeBuilder familyTreeBuilder, string[] tokens)
        {
            tokens = tokens[0].Split();
            var name     = $"{tokens[0]} {tokens[1]}";
            var birthday = tokens[2];

            familyTreeBuilder.SetFullInfo(name, birthday);
        }
Ejemplo n.º 2
0
        private static void ParseInput(string input, FamilyTreeBuilder familyTreeBuilder)
        {
            var tokens = input.Split(" - ");

            if (tokens.Length > 1)
            {
                ParentChild(familyTreeBuilder, tokens);
            }
            else
            {
                FullInfo(familyTreeBuilder, tokens);
            }
        }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            var mainPersonInput   = Console.ReadLine();
            var familyTreeBuilder = new FamilyTreeBuilder(mainPersonInput);

            string input;

            while ((input = Console.ReadLine()) != "End")
            {
                ParseInput(input, familyTreeBuilder);
            }

            Console.WriteLine(familyTreeBuilder.Build());
        }
Ejemplo n.º 4
0
 private static void ParentChild(FamilyTreeBuilder familyTreeBuilder, IReadOnlyList <string> tokens)
 {
     familyTreeBuilder.SetParentChildRelation(tokens[0], tokens[1]);
 }