コード例 #1
0
        private bool preference; // true = EVEN, false = ODD

        //-----------------------------------------------------------
        public mixReps()
        {
            // Initialize blurtRep objects
            x = new blurtReps(maxChar, maxPing, outputState);
            z = new blurtReps(maxChar, maxPing, outputState);

            // Initialize mixCount and preference
            mixCount   = 1;
            preference = true;
        }
コード例 #2
0
        static void Main()
        {
            int    maxChar = 5;
            int    maxPing = 6;
            int    outputState = 1; // 1=plain, 2=repeat, 3=terse
            int    minLength, maxLength;
            string word;
            string nonWord   = "1@#r";
            string weirdWord = "asdfg";

            minLength = 1;
            maxLength = 5;

            int  mixCount1  = 1;
            int  mixCount2  = 2;
            bool preference = false;

            // Let's test mixReps
            word = RndGenerators.RandomString(RndGenerators.RandomNum(minLength, maxLength));
            mixReps mixRObj = new mixReps();

            mixRObj.MixTheReps(word, mixCount1, preference);
            Console.WriteLine("-------------------");
            mixRObj.MixTheReps(word, mixCount2, preference);
            Console.WriteLine("-------------------");

            preference = true;

            mixRObj.MixTheReps(word, mixCount1, preference);
            Console.WriteLine("-------------------");
            mixRObj.MixTheReps(word, mixCount2, preference);
            Console.WriteLine("-------------------");

            blurtReps blurtIt  = new blurtReps(maxChar, maxPing, outputState);
            blurtReps blurtIt2 = new blurtReps(maxChar, maxPing, outputState);
            blurtReps blurtIt3 = new blurtReps(maxChar, maxPing, outputState);

            // Let's test cohortReps
            CohortReps aCohort = new CohortReps();

            aCohort.Adder(ref blurtIt, word);
            aCohort.Adder(ref blurtIt2, nonWord);
            aCohort.Adder(ref blurtIt3, weirdWord);
            aCohort.Remover(ref blurtIt2);
            aCohort.HowMany();
            Console.WriteLine("-------------------");
            aCohort.Concatenator();
        }
コード例 #3
0
        //-----------------------------------------------------------
        public void Remover(ref blurtReps obj)
        {
            int length = cohorts.Length;

            for (int i = 0; i < length; i++)
            {
                if (cohorts[i] == obj)
                {
                    cohorts[i] = null;
                    Console.WriteLine("An object has been removed.");
                    length--;

                    if (cohorts[i + 1] == null)
                    {
                        for (int j = i; j < length; j++)
                        {
                            cohorts[i] = cohorts[i + 1];
                        }
                    }
                }
            }
            repNum--;
        }
コード例 #4
0
 //-----------------------------------------------------------
 public void Adder(ref blurtReps obj, string passedString)
 {
     cohorts[repNum] = obj;
     obj.Ping(passedString);
     repNum++;
 }