Example #1
0
        static void Main(string[] args)
        {
            var nyt = new NYPaper();
            var lat = new LAPaper();

            IIterator nytIterator = nyt.CreateIterator();
            IIterator latIterator = lat.CreateIterator();

            System.Console.WriteLine("NYT Paper reporters: ");
            PrintReporters(nytIterator);

            System.Console.WriteLine("LAT Paper reporters: ");
            PrintReporters(latIterator);
        }
Example #2
0
        static void Main(string[] args)
        {
            INewspaper nyp = new NYPaper();
            INewspaper lap = new LAPaper();

            IIterator nypIterator = nyp.CreateIterator();
            IIterator lapIterator = lap.CreateIterator();

            Console.WriteLine("-----    NYPaper");
            PrintReporters(nypIterator);

            Console.WriteLine("-----    LAPaper");
            PrintReporters(lapIterator);
        }
Example #3
0
        static void Main(string[] args)
        {
            INewspaper ny = new NYPaper();
            INewspaper la = new LAPaper();
            //Aggregates for create to different optional iterators



            IIterator nyIterator = ny.CreateIterator();
            IIterator laIterator = la.CreateIterator();

            // Iterators

            Console.WriteLine("----- LAPaper");
            PrintReporters(laIterator);


            Console.WriteLine("----- NYPaper");
            PrintReporters(nyIterator);
        }
        //step five

        static void Main(string[] args)
        {
            //create instances of each paper.
            INewspaper nyt = new NYPaper();
            INewspaper lat = new LAPaper();

            //invoke CreateIterator for each paper.
            //the data for each paper comes from NYPaper and LAPaper
            //but the logic of how the data is presented comes via the iterators.
            //the instance of nyt flags the code to use the NYPaperIterator,
            //and same with lat and LA.
            IIterator nypIterator = nyt.CreateIterator();
            IIterator lapIterator = lat.CreateIterator();

            Console.WriteLine("--------   NYPaper");
            PrintReporters(nypIterator);

            Console.WriteLine("--------   LAPaper");
            PrintReporters(lapIterator);

            Console.ReadLine();
        }
Example #5
0
        static void Main(string[] args)
        {
            var nyt = new NYPaper();
            var lat = new LAPaper();

            Console.WriteLine("--------   NYPaper");
            PrintCollectionItems(nyt.Reporters);

            Console.WriteLine("--------   LAPaper");
            PrintCollectionItems(lat.Reporters);

            //IIterator nypIterator = nyt.CreateIterator();
            //IIterator lapIterator = lat.CreateIterator();

            //Console.WriteLine("--------   NYPaper");
            //PrintReporters(nypIterator);

            //Console.WriteLine("--------   LAPaper");
            //PrintReporters(lapIterator);

            Console.ReadLine();
        }