Esempio n. 1
0
        protected int Compare(T a, T b)
        {
            CompareEvent?.Invoke(this, new Tuple <T, T>(a, b));
            ComparisonCount++;

            return(a.CompareTo(b));
        }
 public void CompareNumbers(int n)
 {
     if (Myint > n)
     {
         Console.WriteLine("boyukdur");
     }
     else
     {
         CompareEvent?.Invoke(n, Myint);
     }
 }
Esempio n. 3
0
 public void CompareNumbers(int cmv)
 {
     if (Myint > cmv)
     {
         Console.WriteLine("boyukdur");
     }
     else
     {
         CompareEvent.Invoke(cmv, Myint);
     }
 }
Esempio n. 4
0
 protected int Compare(int index1, int index2)
 {
     if (index1 < Items.Count && index2 < Items.Count)
     {
         CompareEvent?.Invoke(this, new Tuple <T, T>(Items[index1], Items[index2]));
         ComparisonCount++;
         return(Items[index1].CompareTo(Items[index2]));
     }
     else
     {
         throw new ArgumentOutOfRangeException();
     }
 }
Esempio n. 5
0
        // Finds the best unit to attack, given the team to not attack against and a comparative delegate
        public virtual void findUnitToAttack(int teamID, out int[] best, CompareEvent<Unit> compareEvent)
        {
            best=	new int[]	{ -1, -1 };

            for(int h= 0; h< teams.size; h++)
            {
                if(h== teamID)
                    continue;
                for(int k= 0; k< teams.items[h].units.size; k++)
                {
                    if(best[0]== -1)
                    {
                        best=	teams.items[h].units.items[k].mapPos;
                        continue;
                    }

                    if(compareEvent(teams.items[getTeamID(best)].units.items[getUnitID(best)], teams.items[h].units.items[k])) // If true, then the new comparison will be the best one
                        best=	teams.items[h].units.items[k].mapPos;
                }
            }
        }
Esempio n. 6
0
 public void Call_CompareEvent(object sender, Tuple <T, T> e)
 {
     CompareEvent?.Invoke(sender, e);
 }
        public int Compare(T x, T y)
        {
            CompareEvent?.Invoke(this, new Tuple <T, T>(x, y));

            return(x.CompareTo(y));
        }
Esempio n. 8
0
 public int Compare(int firstIndex, int secondIndex)
 {
     CompareEvent?.Invoke(this, new Tuple <int, int>(firstIndex, secondIndex));
     CompareCount++;
     return(Items[firstIndex].CompareTo(Items[secondIndex]));
 }
Esempio n. 9
0
        private void OnCompare(object sender, Tuple <T, T> e)
        {
            _result.ComparsionsCount++;

            CompareEvent?.Invoke(this, e);
        }