示例#1
0
        static void Main(string[] args)
        {
            PrinterCreater printerCreater = null;

            printerCreater = new Canon("Canon");
            printerCreater.PrintMethod();

            printerCreater = new HP("HP");
            printerCreater.PrintMethod();


            Console.ReadKey();
        }
示例#2
0
        static void Run(String Pat, String Source)
        {
            List <int> result = new List <int>();

            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Start();

            result = HP.FindAll(Pat, Source);

            stopwatch.Stop();

            Console.WriteLine(stopwatch.Elapsed);
        }
示例#3
0
        static void Main(string[] args)
        {
            Printer printer = new Canon("принтер Canon");
            Paper   paper1  = printer.Create();

            printer.Print(paper1.Type);

            printer = new HP("принтер HP");
            Paper paper2 = printer.Create();

            printer.Print(paper2.Type);

            Console.ReadLine();
        }
示例#4
0
        public static HP Compile(String pattern)
        {
            char[] x = pattern.ToCharArray();
            int    m = x.Length;

            int[] bmBc = new int[65536];

            PreBmBc(x, bmBc);

            HP hp = new HP();

            hp.x    = x;
            hp.bmBc = bmBc;
            hp.m    = m;

            return(hp);
        }