Beispiel #1
0
        private void popCorrectTextboxes(Rows madeRows)
        {
            //Populate textboxes 27 tom 39
            TextBox[] boxes = {textBox27,textBox28,textBox29,textBox30,textBox31,textBox32,textBox33,
                                textBox34,textBox35,textBox36,textBox37,textBox38,textBox39, textBox40};

            int j = 0;
            foreach( TextBox textBox in boxes )
            {
                textBox.Text = madeRows.correctList[j++].ToString();
            }
        }
Beispiel #2
0
        //Reducera max och min tecken på en rad
        //public void reduceMaxMin(Rows madeRows)
        public void reduceMaxMin(Rows myRowes)
        {
            //Initialisera matris reducerade rader
            reducedRows = new string[myRowes.totalRows + 1, 13];
            
            //Räknare för antal 1,X,2
            int count1 = 0;
            int count2 = 0;
            int countX = 0;

            //Stega igenom rawRowes, rader sen kolumner
            int nyrad = 1;
            for( int rad = 1 ; rad <= myRowes.totalRows ; rad++ )
            {
                for( int match = 0 ; match < 13 ; match++ )
                {
                    //gör strcmp och öka räknare för varje tecken som hittas
                    //if( String.Compare(madeRows.rawRowes[rad, match], "1") == 0 )
                    if( String.Compare(myRowes.rawRowes[rad, match], "1") == 0) 
                    {
                        count1++;
                    }
                    //else if( String.Compare(madeRows.rawRowes[rad, match], "2") == 0 )
                    else if( String.Compare(myRowes.rawRowes[rad, match], "2") == 0 )
                    {
                        count2++;
                    }
                    else
                    {
                        countX++;
                    }
                }
                //{ 14, 99, 14, 99, 14, 99, -1, 99, -1, 99, -1, 99 }; 
                int max1 = reduceFlags[0];
                int maxX = reduceFlags[2];
                int max2 = reduceFlags[4];
                int min1 = reduceFlags[6];
                int minX = reduceFlags[8];
                int min2 = reduceFlags[10];
                //Jämför med constraints och spara rad om den är inom intervall
                //Om rader ska tas bort öka räknare för reducerade rader .
                if( count1 <= max1 && count1 >= min1 && count2 <= max2 && count2 >= min2 && countX <= maxX && countX >= minX )
                //if( count1 <= reduceFlags[0] && count1 >= reduceFlags[2] && count2 <= reduceFlags[4] && count2 >= reduceFlags[6] && countX <= reduceFlags[8] && countX >= reduceFlags[10] )
                {

                    //Spara rad
                    for( int match = 0 ; match < 13 ; match++ )
                    {
                        //reducedRows[nyrad, match] = madeRows.rawRowes[rad, match]; //Spara rader som inte ska reduceras bort
                        reducedRows[nyrad, match] = myRowes.rawRowes[rad, match]; 
                    }
                    //Öka räknare för sparade rader
                    savedRowesCounter++;
                    //I detta scope så att den bara går framåt vid sparad rad.
                    nyrad++;
                }
                //Nollställ räknare mellan varje rad
                count1 = count2 = countX = 0;

            }

        }
Beispiel #3
0
        //Skriver ut antal rader, helgarderingar och halvgarderingar
        private void populateRowTextboxes(Rows madeRows)
        {
            //Skriv ut antal rader
            if( madeRows.totalRows <= 1 )
            {
                textBox18.Text = "Enkelrad";
            }
            else
            {
                textBox18.Text = madeRows.totalRows.ToString();
            }

            //Skriv ut antal helgarderingar
            textBox20.Text = madeRows.wholeGuards.ToString();

            //Skriv ut antal halvgarderingar
            textBox22.Text = madeRows.halfGuards.ToString();

            //Räkna ihop antal singlar
            textBox24.Text = madeRows.singles.ToString();

        }