示例#1
0
 public Rule(RuleType T, Comparitor C, int V)
 {
     this.Type = T;
     this.Compare = C;
     this.Value = V;
     this.SearchRadius = 1;
 }
示例#2
0
 private static void  downheap(SupportClass.ListCollectionSupport v, Comparitor comp, int k, int N)
 {
     System.Object T = v.Get(k - 1);
     while (k <= N / 2)
     {
         int j = k + k;
         if ((j < N) && (comp.Compare(v.Get(j - 1), v.Get(j)) < 0))
         {
             j++;
         }
         if (comp.Compare(T, v.Get(j - 1)) >= 0)
         {
             break;
         }
         else
         {
             v.Set(k - 1, v.Get(j - 1));
             k = j;
         }
     }
     v.Set(k - 1, T);
 }
示例#3
0
        /// <summary> Method for actually performing the heap sort.</summary>
        /// <param name="v">          Vector to sort
        /// </param>
        /// <param name="comp">       Comparitor to compare the elements of the vector
        /// </param>
        /// <exception cref="">   java.lang.Exception     Any exception at all
        /// </exception>
        /// <seealso cref="Comparitor">
        /// </seealso>
        public static void  sort(SupportClass.ListCollectionSupport v, Comparitor comp)
        {
            int N = v.Count;

            if (N < 1)
            {
                return;
            }
            for (int k = N / 2; k > 0; k--)
            {
                downheap(v, comp, k, N);
            }
            do
            {
                System.Object T;
                T = v.Get(0);
                v.Set(0, v.Get(N - 1));
                v.Set(N - 1, T);
                N = N - 1;
                downheap(v, comp, 1, N);
            }while (N > 1);
        }