Esempio n. 1
0
        private static void GenerateBoundaryBits()
        {
            const int length    = 100000;
            const int runsCount = 100;

            using (var outputStream = File.Open(string.Format("D:\\statistics\\boundary_bits_{0}.txt", length), FileMode.Create))
                using (var output = new StreamWriter(outputStream))
                {
                    output.WriteLine("k | coeff");

                    var removeStrategy = new RemoveBorderStrategy();
                    var logger         = new ConsoleTextLengthLogger(length / 100);
                    var detectEqual    = false;

                    for (var k = 5; k <= 10; ++k)
                    {
                        Console.WriteLine("Conversion for k = {0}", k);
                        var text = new StringBuilder();

                        var e         = new RationalNumber(k, k - 1);
                        var generator = new CleverCharGenerator(text, k, e, detectEqual);
                        var detector  = new RepetitionDetector(text, e, detectEqual);

                        Calculate(runsCount, detector, length, removeStrategy, generator, logger, output);
                    }
                }
        }
Esempio n. 2
0
        private static void GenerateSquare()
        {
            var Runs    = new[] { 100 };
            var lengths = new[] { 100000 };

            using (var outputStream = File.Open("D:\\statistics\\square4.txt", FileMode.Create))
                using (var output = new StreamWriter(outputStream))
                {
                    for (var i = 0; i < Runs.Length; ++i)
                    {
                        var logger = new ConsoleTextLengthLogger(1000);
                        var text   = new StringBuilder();

                        var e              = new RationalNumber(2);
                        var generator      = new RandomNotLastCharGenerator(text, 4);
                        var detector       = new RepetitionDetector(text, e, true);
                        var removeStrategy = new RemoveBorderStrategy();

                        Calculate(Runs[i], detector, lengths[i], removeStrategy, generator, logger, output);
                    }
                }
        }