public void CalcIndex()
        {
            try
            {
                uQlustCore.RandIndex calc = new uQlustCore.RandIndex();

                if (!radioButton1.Checked)
                {
                    maxV = 0;
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        maxV += calc.Size((List <List <string> >)(dataGridView1.Rows[gridPosition[tmp[0]]].Cells[5].Value), (List <List <string> >)(dataGridView1.Rows[gridPosition[tmp[1]]].Cells[5].Value));
                    }
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        calc.ClusterDistance((List <List <string> >)(dataGridView1.Rows[gridPosition[tmp[0]]].Cells[5].Value), (List <List <string> >)(dataGridView1.Rows[gridPosition[tmp[1]]].Cells[5].Value), (string)listBox1.Items[i], ref currentV, 0);
                    }
                }
                else
                {
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        for (int j = (int)numericUpDown1.Value; j < (int)numericUpDown2.Value; j++, currentV++)
                        {
                            string[] tmp = ((string)listBox1.Items[i]).Split('+');
                            List <List <string> > cl1 = null;
                            List <List <string> > cl2 = null;

                            if (dicOuput[tmp[0]].hNode != null)
                            {
                                cl1 = dicOuput[tmp[0]].hNode.GetClusters(j);
                            }
                            else
                            if (dicOuput[tmp[0]].clusters != null)
                            {
                                cl1 = dicOuput[tmp[0]].clusters;
                            }

                            if (dicOuput[tmp[1]].hNode != null)
                            {
                                cl2 = dicOuput[tmp[1]].hNode.GetClusters(j);
                            }
                            else
                            if (dicOuput[tmp[1]].clusters != null)
                            {
                                cl2 = dicOuput[tmp[1]].clusters;
                            }

                            maxV += calc.Size(cl1, cl2);
                        }
                    }

                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        List <List <string> > cl1 = null;
                        List <List <string> > cl2 = null;

                        for (int j = (int)numericUpDown1.Value; j < (int)numericUpDown2.Value; j++, currentV++)
                        {
                            if (dicOuput[tmp[0]].hNode != null)
                            {
                                cl1 = dicOuput[tmp[0]].hNode.GetClusters(j);
                            }
                            else
                            if (dicOuput[tmp[0]].clusters != null)
                            {
                                cl1 = dicOuput[tmp[0]].clusters;
                            }

                            if (dicOuput[tmp[1]].hNode != null)
                            {
                                cl2 = dicOuput[tmp[1]].hNode.GetClusters(j);
                            }
                            else
                            if (dicOuput[tmp[1]].clusters != null)
                            {
                                cl2 = dicOuput[tmp[1]].clusters;
                            }


                            if (cl1 == null)
                            {
                                throw new Exception(tmp[0] + " is a type of clustering that is not supported by this tool");
                            }

                            if (cl2 == null)
                            {
                                throw new Exception(tmp[1] + " is a type of clustering that is not supported by this tool");
                            }

                            calc.ClusterDistance(cl1, cl2, (string)listBox1.Items[i], ref currentV, j);
                        }
                    }
                }
                resTable = calc.resT;
                currentV = maxV;
            }
            catch (Exception ex)
            {
                exc = ex;
            }
        }
        public void CalcIndex()
        {
            try
            {

                uQlustCore.RandIndex calc = new uQlustCore.RandIndex();

                if (!radioButton1.Checked)
                {
                    maxV = 0;
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        maxV += calc.Size((List<List<string>>)(dataGridView1.Rows[gridPosition[tmp[0]]].Cells[5].Value), (List<List<string>>)(dataGridView1.Rows[gridPosition[tmp[1]]].Cells[5].Value));
                    }
                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        calc.ClusterDistance((List<List<string>>)(dataGridView1.Rows[gridPosition[tmp[0]]].Cells[5].Value), (List<List<string>>)(dataGridView1.Rows[gridPosition[tmp[1]]].Cells[5].Value), (string)listBox1.Items[i], ref currentV, 0);
                    }
                }
                else
                {
                    for (int i = 0; i < listBox1.Items.Count; i++)
                        for (int j = (int)numericUpDown1.Value; j < (int)numericUpDown2.Value; j++, currentV++)
                        {
                            string[] tmp = ((string)listBox1.Items[i]).Split('+');
                            List<List<string>> cl1 = null;
                            List<List<string>> cl2 = null;

                            if (dicOuput[tmp[0]].hNode != null)
                                cl1 = dicOuput[tmp[0]].hNode.GetClusters(j);
                            else
                                if (dicOuput[tmp[0]].clusters != null)
                                    cl1 = dicOuput[tmp[0]].clusters;

                            if (dicOuput[tmp[1]].hNode != null)
                                cl2 = dicOuput[tmp[1]].hNode.GetClusters(j);
                            else
                                if (dicOuput[tmp[1]].clusters != null)
                                    cl2 = dicOuput[tmp[1]].clusters;

                            maxV += calc.Size(cl1, cl2);

                        }

                    for (int i = 0; i < listBox1.Items.Count; i++)
                    {
                        string[] tmp = ((string)listBox1.Items[i]).Split('+');
                        List<List<string>> cl1 = null;
                        List<List<string>> cl2 = null;

                        for (int j = (int)numericUpDown1.Value; j < (int)numericUpDown2.Value; j++, currentV++)
                        {

                            if (dicOuput[tmp[0]].hNode != null)
                                cl1 = dicOuput[tmp[0]].hNode.GetClusters(j);
                            else
                                if (dicOuput[tmp[0]].clusters != null)
                                    cl1 = dicOuput[tmp[0]].clusters;

                            if (dicOuput[tmp[1]].hNode != null)
                                cl2 = dicOuput[tmp[1]].hNode.GetClusters(j);
                            else
                                if (dicOuput[tmp[1]].clusters != null)
                                    cl2 = dicOuput[tmp[1]].clusters;


                            if (cl1 == null)
                                throw new Exception(tmp[0] + " is a type of clustering that is not supported by this tool");

                            if (cl2 == null)
                                throw new Exception(tmp[1] + " is a type of clustering that is not supported by this tool");

                            calc.ClusterDistance(cl1, cl2, (string)listBox1.Items[i], ref currentV, j);
                        }
                    }
                }
                resTable = calc.resT;
                currentV = maxV;
            }
            catch(Exception ex)
            {
                exc = ex;
            }
        }