예제 #1
0
 public static ShapePrinter getInstance()
 {
     if (instance == null)
     {
         instance = new ShapePrinter();
     }
     return(instance);
 }
예제 #2
0
        static void Main(string[] args)
        {
            Random       generator;
            List <Shape> shapeList;
            String       outdesc;

            shapeList = new List <Shape>();
            generator = new Random();
            Shape t_s;

            for (int i = 0; i < 10; i++)
            {
                double ds = generator.NextDouble();
                if (ds < 0.25)
                {
                    t_s = ShapeGenerator.getCircle(generator, out outdesc, multiplier);
                }
                else if (ds >= 0.25 && ds < 0.50)
                {
                    t_s = ShapeGenerator.getTriangle(generator, out outdesc, multiplier);
                }
                else if (ds >= 0.50 && ds < 0.75)
                {
                    t_s = ShapeGenerator.getSphere(generator, out outdesc, multiplier);
                }
                else
                {
                    t_s = ShapeGenerator.getPoligon(generator, out outdesc, multiplier / 4.0);
                }
                shapeList.Add(t_s);
                Console.WriteLine(outdesc);
            }

            Console.ReadKey();

            ShapePrinter S = ShapePrinter.getInstance();

            S.readShapeList(shapeList);
            Console.ReadLine();
        }
예제 #3
0
 public void reset()
 {
     instance = null;
 }