Exemplo n.º 1
0
        public void setPercentage(double percentage)
        {
            int[] newIndexing = new int[sizing.Length];
            for (int i = 0; i < newIndexing.Length; i++)
            {
                newIndexing[i] = i;
            }
            MergeSort sorting  = new MergeSort(sizing, newIndexing);
            int       numbSize = (int)(sizing.Length * percentage);

            newIndexing = sorting.getIndex();
            int[] arrayIndex = new int[listPassages.Length];
            for (int i = 0; i < numbSize; i++)
            {
                int count = indexing[0];
                for (int j = 0; j < listPassages.Length; j++)
                {
                    if (newIndexing[sizing.Length - i - 1] < count)
                    {
                        arrayIndex[j]++;
                        break;
                    }
                    count += indexing[j + 1];
                }
            }
            for (int i = 0; i < listPassages.Length; i++)
            {
                listPassages[i].setPercentage(1.0 * arrayIndex[i] / (indexing[i] - 1));
            }
        }
Exemplo n.º 2
0
        public string[] getFillInBlankLarge()
        {
            string[] result = new string[delimitation.Length];
            int[]    size   = new int[delimitation.Length];
            int[]    index  = new int[delimitation.Length];
            for (int i = 0; i < size.Length; i++)
            {
                size[i]  = delimitation[i].Length;
                index[i] = i;
            }
            MergeSort sorting = new MergeSort(size, index);

            index = sorting.getIndex();
            int len_index = (int)(delimitation.Length * this.percentage);

            int[] size_index = new int[len_index];
            for (int i = 0; i < len_index; i++)
            {
                size_index[i] = index[delimitation.Length - 1 - i];
            }
            for (int i = 0; i < delimitation.Length; i++)
            {
                bool isLarge = false;
                for (int j = 0; j < len_index; j++)
                {
                    if (i == size_index[j])
                    {
                        result[i] = delimitation[i];
                        isLarge   = true;
                        break;
                    }
                }
                if (!isLarge && !delimitation[i].Equals(""))
                {
                    result[i] = "_______";
                }
            }
            return(result);
        }