Esempio n. 1
0
 private void compareTextToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (currentControl != null)
     {
         currentControl.Compare();
     }
 }
Esempio n. 2
0
        public static void Sort(int[][] array, ICompare compare)
        {
            if (array == null || compare == null)
            {
                throw new ArgumentNullException();
            }
            bool swaped;

            for (int i = 0; i < array.Length; i++)
            {
                swaped = false;
                for (int y = 0; y < array.Length - 1; y++)
                {
                    if (compare.Compare(array[y], array[y + 1]) > 0)
                    {
                        Swap(array, y, y + 1);
                        swaped = true;
                    }
                }
                if (!swaped)
                {
                    break;
                }
            }
        }
Esempio n. 3
0
        public void PerformComparisonAndCleanUp(IThresholdRecieve inputRecieve, IDataExtract dataExtract, ICompare compare,
                                                IDataRemove dataRemove, string fileName, string zipPath, string outputPath)
        {
            var qualityThresholdList = inputRecieve.getThresholdList(fileName);
            var csvThresholdList     = dataExtract.ExtractData(outputPath);

            compare.Compare(qualityThresholdList, csvThresholdList);
            Thread.Sleep(10000);
            dataRemove.Remove(Path.GetFullPath(Directory.GetCurrentDirectory()), zipPath, fileName);
        }
 public static void BubbleSort(this int[][] jaggedArray, ICompare howToSort)
 {
     for (int i = 0; i < jaggedArray.GetLength(0) - 1; i++)
     {
         for (int j = 1; j <= jaggedArray.GetLength(0) - 1; j++)
         {
             if (howToSort.Compare(jaggedArray[i], jaggedArray[j]) == -1)
             {
                 Swap(ref jaggedArray[i], ref jaggedArray[j]);
             }
         }
     }
 }
 public static void SortArr(int[][] jagged, ICompare<int[]> method)
 {
     if (jagged == null) throw new ArgumentNullException("jugged");        
     for (int i = 0; i < jagged.Length; i++)
     {
         for (int j = i + 1; j < jagged.Length; j++)
         {
             if (method.Compare(jagged[i], jagged[j]) > 0)
             {
                 Swap(ref jagged[i], ref jagged[j]);
             }
         }
     }
 }
Esempio n. 6
0
 /// <summary>
 /// Sort method.
 /// </summary>
 /// <param name="array"></param>
 /// <param name="size"></param>
 /// <param name="methodOfCompare"></param>
 public void BubbleSort(ref T[] array, int size, ICompare <T> methodOfCompare)
 {
     for (int i = 0; i < size - 1; ++i)
     {
         for (int j = i + 1; j < size; ++j)
         {
             if (methodOfCompare.Compare(array[i], array[j]))
             {
                 T temp = array[i];
                 array[i] = array[j];
                 array[j] = temp;
             }
         }
     }
 }
 public void Sort(ICompare <T> itemComparer)
 {
     for (var i = 0; i < list.Count - 1; i++)
     {
         for (var j = i + 1; j < list.Count; j++)
         {
             var left  = (T)(list[i]);
             var right = (T)(list[j]);
             if (itemComparer.Compare(left, right) > 0)
             {
                 var temp = list[i];
                 list[i] = list[j];
                 list[j] = temp;
             }
         }
     }
 }
        private void btnCompare_Click(object sender, EventArgs e)
        {
            try
            {
                String text = rtText.Text;

                String   subText  = tbSubText.Text;
                ICompare comparer = null;

                comparer = ComparerFactory.Get(cbLegacyCompare.Checked ? ComparerFactory.ComparerType.Legacy : ComparerFactory.ComparerType.Yield);

                PrintResults(comparer.Compare(text, subText));
            }
            catch (Exception ex)
            {
                lbResults.Text = ex.Message;
            }
        }
Esempio n. 9
0
        public List <string> Compare()
        {
            ICompare compare = GetCompareOption(_function);

            return(compare.Compare(_column1, _column2));
        }
 public static void SortArrDel(int[][] array, ICompare<int[]> comparer)
 {
     SortArrDel(array, (a, b) => comparer.Compare(a, b));
 }
Esempio n. 11
0
 public static void MyFunc(ICompare ic1, ICompare ic2)
 {
     Console.WriteLine("bc1.Compare(bc2) returned {0}", ic1.Compare(ic2));
 }
Esempio n. 12
0
 /// <summary>
 /// Does the compare without calling <see cref="BaseConstraint.LockCompare"/> and <see cref="BaseConstraint.UnLockCompare"/>.
 /// </summary>
 /// <param name="attributeBag">The attribute bag.</param>
 protected override bool DoCompare(IAttributeBag attributeBag)
 {
     return(EvaluateAndOrAttributes(attributeBag, comparer.Compare(attributeBag.GetValue(attributeName))));
 }
Esempio n. 13
0
 /// <summary>
 /// Does the compare without calling <see cref="LockCompare"/> and <see cref="UnLockCompare"/>.
 /// </summary>
 /// <param name="attributeBag">The attribute bag.</param>
 protected virtual bool doCompare(IAttributeBag attributeBag)
 {
     return(EvaluateAndOrAttributes(attributeBag, comparer.Compare(attributeBag.GetValue(attributeName))));
 }
Esempio n. 14
0
 public OutputWrapper Compare(Bitmap img1, Bitmap img2)
 {
     return(comparer.Compare(img1, img2));
 }
Esempio n. 15
0
 public bool IsTextContainedIn(string text)
 {
     return(containsText.Compare(text));
 }