예제 #1
0
        private static void CreateSquareList()
        {
            Square s1 = new Square(3);
            Square s2 = new Square(4);
            Square s3 = new Square(5);

            ListShape <Square> q2 = new ListShape <Square>();

            AddBuffer <Square>(q2, s1);
            AddBuffer <Square>(q2, s2);
            AddBuffer <Square>(q2, s3);

            Console.WriteLine("Elements in the List of Squares....");
            PrintAllBuffer(q2);

            AbstractShape sd = DeleteBuffer(q2);

            Console.WriteLine($"Square  :  with side-  {sd._param} :  area - {sd._area} :  circuference - {sd._circumference} got deleted from the list ");

            Console.WriteLine("Elements in the List of Squares post deletion of S2....");

            PrintAllBuffer(q2);
        }
예제 #2
0
        private static void CreateCircleQueue()
        {
            Circle c1 = new Circle(3);
            Circle c2 = new Circle(4);
            Circle c3 = new Circle(5);


            QueueShape <AbstractShape> q1 = new QueueShape <AbstractShape>();

            AddBuffer <Circle>(q1, c1);
            AddBuffer <Circle>(q1, c2);
            AddBuffer <Circle>(q1, c3);

            Console.WriteLine("Elements in the Queue of Circles....");

            PrintAllBuffer(q1);

            AbstractShape del = DeleteBuffer(q1);

            Console.WriteLine($"Circle  :  with radius-  {del._param} :  area - {del._area} :  circuference - {del._circumference} got deleted from the queue ");

            Console.WriteLine("Elements in the Queue of Circles after deletion...");
            PrintAllBuffer(q1);
        }