Esempio n. 1
0
 public Research(IRelationshipBrowser relationshipBrowser)
 {
     foreach (var p in relationshipBrowser.FindAllChildrenOf("John"))
     {
         Console.WriteLine("John has a child called : {0}", p.Name);
     }
 }
 public DRunner(IRelationshipBrowser browser)
 {
     foreach (var p in browser.FindAllChildrenOf("John"))
     {
         Console.WriteLine($"John has a child named {p.Name}");
     }
 }
Esempio n. 3
0
        //public Program(Relationships relationships)
        //{
        //    var relations = relationships.Relations;

        //    foreach (var r in relations.Where(x => x.Item1.Name == "John" && x.Item2 == Relationship.Parent))
        //    {
        //        Console.WriteLine($"John has a child called {r.Item3.Name}");
        //    }
        //}

        public Program(IRelationshipBrowser browser)
        {
            foreach (var p in browser.FindAllChildrenOf("John"))
            {
                Console.WriteLine($"John has a child called {p.Name}");
            }
        }
Esempio n. 4
0
 public Research(IRelationshipBrowser relBrowser)
 {
     foreach (var child in relBrowser.FindAllChildrenOf("John"))
     {
         Console.WriteLine($"John has child called {child.Name}");
     }
 }
Esempio n. 5
0
 public static void SearchAfter(PersonAfter parent, IRelationshipBrowser browser)
 {
     foreach (var r in browser.FindALlChildrenOf(parent.Name))
     {
         Console.WriteLine($"{parent.Name} has a child called {r.Name}");
     }
 }
Esempio n. 6
0
 public SingleResponsibility(IRelationshipBrowser browser)
 {
     foreach (var r in browser.FindAllChindrenOf("John"))
     {
         Console.WriteLine($"John has a child called {r.Name}");
     }
 }
Esempio n. 7
0
        //public Research(Relationships relationships)
        //{
        //    var relations = relationships.Relations;
        //    foreach (var r in relations.Where(x => x.Item1.Name == "John" && x.Item2 == Relationship.Parent))
        //    {
        //        WriteLine($"John has a child called {r.Item3.Name}");
        //    }
        //}

        public Research(IRelationshipBrowser browser)
        {
            foreach (var p in browser.FindAllChildrenOf("John"))
            {
                WriteLine($"John has a child called {p.Name}");
            }
        }
Esempio n. 8
0
 //public Research(Relationships relationships)
 //{
 //    var relations = relationships.Relations;
 //    foreach (var item in relations.Where(x => x.Item1.Name == "Gela" && x.Item2 == Relationship.Parent))
 //        Console.WriteLine($"Gelas yavs shvili {item.Item3.Name}");
 //}
 public Research(IRelationshipBrowser browser)
 {
     foreach (var p in browser.FindAllChildrenOf("Gela"))
     {
         Console.WriteLine($"gelas shvilebi: {p.Name}");
     }
 }
 public Research(IRelationshipBrowser browser)
 {
     foreach (Person child in browser.FindAllChildOf("John"))
     {
         Console.WriteLine($"John has a child called {child.Name}");
     }
 }
Esempio n. 10
0
 public Program(IRelationshipBrowser browser)
 {
     foreach (var p in browser.FindAllChildrenOf("john"))
     {
         //get relationship here
     }
 }
Esempio n. 11
0
 public IEnumerable <Person> DoResearch(IRelationshipBrowser browser)
 {
     foreach (var p in browser.FindAllChildrenOf("John"))
     {
         yield return(p);
     }
 }
Esempio n. 12
0
 public BetterResearch(IRelationshipBrowser browser) // access to low level through abstraction
 {
     foreach (var r in browser.FindAllChildrenOf("John"))
     {
         Console.WriteLine($"John has a child called: {r.Name}");
     }
 }
 public Research(IRelationshipBrowser browser, string name)
 {
     foreach (var p in browser.FindAllChildrenOf(name))
     {
         Debug.Log(string.Format("{0} has a child call {1}", name, p.Name));
     }
 }
Esempio n. 14
0
        // now what if we want to change some code in relationships class(low level class).
        // Then we might need to do some change in high level class (Program)
        // this is violating DependencyInversion
        // we will create an interface so that high level module will depend on abstraction not concretions
        //public Program(Relationships relationships)
        //{
        //    var relations = relationships.Relations;
        //    foreach (var item in relations.Where(x=>x.Item1.Name == "Rajesh" && x.Item2 == Relationship.Parent))
        //    {
        //        Console.WriteLine($"Rajesh has a child {item.Item3.Name}");
        //    }
        //}
        public Program(IRelationshipBrowser browser)
        {
            var relations = browser.FindAllChildrenOf("Rajesh");

            foreach (var item in relations)
            {
                Console.WriteLine($"Rajesh has a child {item.Name}");
            }
        }
Esempio n. 15
0
        public Research(IRelationshipBrowser browser)
        {
            var parent = "John";

            foreach (var person in browser.FindAllChildrenOf(parent))
            {
                Console.WriteLine($"{parent} has a child called {person.Name}");
            }
        }
Esempio n. 16
0
        public Research(IRelationshipBrowser browser)
        {
            var children = browser.FindAllChildren("John");

            foreach (var child in children)
            {
                Console.WriteLine($"John has a child called {child.Name}.");
            }
        }
Esempio n. 17
0
        //stari
        //public Program(Relationships relationships)
        //{
        //    //ovo radi sada ali ako izmijenimo Relationships klasu prestaće da radi
        //    var relations = relationships.Relations;

        //    foreach (var r in relations.Where(x => x.Item1.Name == "Dick" && x.Item2 == Relationship.Parent))
        //    {
        //        Console.WriteLine("Dick has a child called " + r.Item3.Name);
        //    }

        //    foreach (var r in relations.Where(x => x.Item1.Name == "Dick" && x.Item2 == Relationship.Sibling))
        //    {
        //        Console.WriteLine("Dick has a sibling called " + r.Item3.Name);
        //    }

        //}
        //novi
        public Program(IRelationshipBrowser relationships, List <Person> people)
        {
            foreach (var person in people)
            {
                foreach (var ch in relationships.FindAllChildrenOf(person))
                {
                    Console.WriteLine(person.Name + " has a child called " + ch.Name);
                }

                foreach (var ch in relationships.FindAllSiblingsOf(person))
                {
                    Console.WriteLine(person.Name + " has a sibling called " + ch.Name);
                }
            }
        }