예제 #1
0
        public static int CompareByRatio(Job job1, Job job2)
        {
            var ratio1 = job1.Weight / (double)job1.Length;
            var ratio2 = job2.Weight / (double)job2.Length;
            if (ratio1 > ratio2)
            {
                return -1;
            }

            if (ratio1 < ratio2)
            {
                return 1;
            }

            return 0;
        }
예제 #2
0
 public static int CompareByDifference(Job job1, Job job2)
 {
     var diff = (job2.Weight - job2.Length) - (job1.Weight - job1.Length);
     return diff != 0 ? diff : job2.Weight - job1.Weight;
 }