コード例 #1
0
        private void ViewProperty_Click(object sender, EventArgs e)
        {
            //// groupElement.Text = "2314413232411423";//autotest
            progressbarContor    = true;
            progressBar.Progress = 0;
            progressBar.Max      = 1000;

            progressBarStatus = 0;

            statusbarThread = new Thread(new ThreadStart(delegate {
                int i = 0;

                while (i < 100)
                {
                    i++;
                    while (progressBarStatus < 1000)
                    {
                        progressBarStatus += 1;
                        if (progressBarStatus < 500)
                        {
                            progressBar.Progress          = progressBarStatus;
                            progressBar.SecondaryProgress = 2 * progressBarStatus;
                        }
                        else
                        {
                            progressBar.SecondaryProgress += 2;
                            progressBar.Progress           = progressBarStatus + 1;
                        }
                        Thread.Sleep(1);//// slep foe 100 ms
                    }
                    progressBarStatus             = 0;
                    progressBar.Progress          = 0;
                    progressBar.SecondaryProgress = 0;
                }
                RunOnUiThread(() => { });
            }));
            statusbarThread.Start();



            int a = GenerateMatrix(groupElement.Text);

            if (a != 0)
            {
                GroupPropertyRepository repo = new GroupPropertyRepository(matrix, a);
                propertyes = repo.allProperty;
                ArrayAdapter ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, propertyes);
                listPropertiesView.Adapter = ListAdapter;
            }
            else
            {
                Toast.MakeText(ApplicationContext, "Matricea trebuie sa fie de forma patrata: N x N", ToastLength.Long).Show();
            }
        }
        private void LegeaII_Click(object sender, EventArgs e)
        {
            if (ifIsClicked)
            {
            }
            else
            {
                ifIsClicked = true;
                InfinitBarAnimation();
            }

            int a = GenerateMatrix(initialGr.Text);

            if (a != 0)
            {
                Labo4Repository repo1 = new Labo4Repository(matrix, a);
                int[,] matrixResult = repo1.produs_cartezian_matrix_legea2;

                GroupPropertyRepository repo2       = new GroupPropertyRepository(matrixResult, a * a);
                List <string>           propertyes  = repo2.allProperty;
                ArrayAdapter            ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, propertyes);
                produceProperty.Adapter = ListAdapter;
                a = a * a;
                string matrixForm = "";
                for (int i = 1; i < a + 1; i++)
                {
                    for (int j = 1; j < a + 1; j++)
                    {
                        matrixForm += "  " + matrixResult[i, j];
                    }
                    matrixForm += "\n";
                }

                MatrixView.Text = matrixForm;
            }
            else
            {
                Toast.MakeText(ApplicationContext, "Matricea trebuie sa fie de forma patrata: N x N", ToastLength.Long).Show();
            }
        }
コード例 #3
0
        private void ViewButton_Click(object sender, EventArgs e)
        {
            int dim = GenerateMatrix(grupulA.Text);

            int[] alphasubsit;
            int   dimAlpha = GenerateSubstitution(alfa.Text, out alphasubsit);

            int[] betasubstit;
            int   dimBeta = GenerateSubstitution(beta.Text, out betasubstit);

            int[] gamasubstit;
            int   dimGama  = GenerateSubstitution(gama.Text, out gamasubstit);
            int   dimGroup = GenerateMatrix(grupulA.Text);

            if (dimAlpha == dimBeta & dimAlpha == dimGama & dimAlpha == dimGroup)
            {
                GroupPropertyRepository repo = new GroupPropertyRepository(matrix, alphasubsit, betasubstit, gamasubstit, dimAlpha);

                int[,] matriceaAlfa = new int[20, 20];
                int[,] matriceaBeta = new int[20, 20];
                int[,] matriceaGama = new int[20, 20];
                matriceaAlfa        = repo.alfaMatrix;
                matriceaBeta        = repo.betaMatrix;
                matriceaGama        = repo.gamaMatrix;

                string matrixFormAlpha = "";
                for (int i = 1; i < dimAlpha + 1; i++)
                {
                    for (int j = 1; j < dimAlpha + 1; j++)
                    {
                        matrixFormAlpha += "  " + matriceaAlfa[i, j];
                    }
                    matrixFormAlpha += "\n";
                }
                string matrixFormBeta = "";
                for (int i = 1; i < dimAlpha + 1; i++)
                {
                    for (int j = 1; j < dimAlpha + 1; j++)
                    {
                        matrixFormBeta += "  " + matriceaBeta[i, j];
                    }
                    matrixFormBeta += "\n";
                }

                string matrixFormGama = "";
                for (int i = 1; i < dimAlpha + 1; i++)
                {
                    for (int j = 1; j < dimAlpha + 1; j++)
                    {
                        matrixFormGama += "  " + matriceaGama[i, j];
                    }
                    matrixFormGama += "\n";
                }

                iteratiaAlfa.Text = matrixFormAlpha;
                iteratiaBeta.Text = matrixFormBeta;
                iteratiaGama.Text = matrixFormGama;



                List <string> propGroupA = new GroupPropertyRepository(matrix, dimGroup).allProperty;
                List <string> propGrGama = new GroupPropertyRepository(matriceaGama, dimGroup).allProperty;

                ArrayAdapter ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, propGroupA);
                grupulAProperty.Adapter = ListAdapter;
                ArrayAdapter ListAdapter1 = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, propGrGama);
                gamaProperty.Adapter = ListAdapter;

                string valuesEA = repo.E(matrix, dimGroup);
                string valuesEG = repo.E(matriceaGama, dimGroup);
                valEa.Text = valuesEA;
                valEg.Text = valuesEG;
            }
            else
            {
                Toast.MakeText(ApplicationContext, "   Dimansiunile grupului sau a substitutiilor nu corespund.", ToastLength.Long).Show();
            }
        }
コード例 #4
0
        private void ShowProperty_Click(object sender, EventArgs e)
        {
            //hd test
            //matrixa.Text = "123312231";
            //matrixb.Text = "1221";
            bool progressbarContor = true;

            progressBar.Progress = 0;
            progressBar.Max      = 1000;
            progressBarStatus    = 0;
            statusbarThread      = new Thread(new ThreadStart(delegate {
                int i = 0;

                while (i < 100)
                {
                    i++;
                    while (progressBarStatus < 1000)
                    {
                        progressBarStatus += 1;
                        if (progressBarStatus < 500)
                        {
                            progressBar.Progress          = progressBarStatus;
                            progressBar.SecondaryProgress = 2 * progressBarStatus;
                        }
                        else
                        {
                            progressBar.SecondaryProgress += 2;
                            progressBar.Progress           = progressBarStatus + 1;
                        }
                        Thread.Sleep(1);//// slep foe 100 ms
                    }
                    progressBarStatus             = 0;
                    progressBar.Progress          = 0;
                    progressBar.SecondaryProgress = 0;
                }
                RunOnUiThread(() => { });
            }));
            statusbarThread.Start();

            int dima = GenerateMatrix(out matriceaA, matrixa.Text);
            int dimb = GenerateMatrix(out matriceaB, matrixb.Text);

            if (dima != 0)
            {
                if (dimb != 0)
                {
                    GroupPropertyRepository repo = new GroupPropertyRepository(matriceaA, matriceaB, dima, dimb);
                    matriceaProdus = repo.matrixProduce;
                    repo           = new GroupPropertyRepository(matriceaProdus, dima * dimb);
                    propertiesList = repo.allProperty;
                    ArrayAdapter ListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, propertiesList);
                    propertyView.Adapter = ListAdapter;

                    string matrixForm = "";
                    for (int i = 1; i < dima * dimb + 1; i++)
                    {
                        for (int j = 1; j < dima * dimb + 1; j++)
                        {
                            matrixForm += "  " + matriceaProdus[i, j];
                        }
                        matrixForm += "\n";
                    }


                    produceView.Text = matrixForm;
                }
                else
                {
                    Toast.MakeText(ApplicationContext, "Matricea B trebuie sa fie de forma patrata: N x N", ToastLength.Long).Show();
                }
            }
            else
            {
                Toast.MakeText(ApplicationContext, "Matricea A trebuie sa fie de forma patrata: N x N", ToastLength.Long).Show();
            }
        }