return 1 if solution 2 is better
483181
public static int CrowdingDistanceCompare(Solution solution1, Solution solution2)
   {
      double crowding1 = solution1.getCrowdingDistance();
      double crowding2 = solution2.getCrowdingDistance();

      if (crowding1 > crowding2)
      {
         return -1;
      }
      else if (crowding1 < crowding2)
      {
         return 1;
      }
      else
      {
         return 0;
      }
   }
772555
function qualityCmp(a, b) {
	if (a.quality === b.quality) {
		return 0;
	} else if (a.quality < b.quality) {
		return 1;
	} else {
		return -1;
	}
}
382927
private int compare(Object key1, Object key2) {
        if (comparator == null)
            return ((Comparable) key1).compareTo(key2);
        else
            return comparator.compare(key1, key2);
    }
130702
def hcf(num1, num2):
    

    if num1 > num2:
        smaller = num2
    else:
        smaller = num1
    for i in range(1, smaller + 1):
        if ((num1 % i == 0) and (num2 % i == 0)):
            return i
1159675
def lcm(num1, num2):
    

    if num1 > num2:
        bigger = num1
    else:
        bigger = num2
    while True:
        if bigger % num1 == 0 and bigger % num2 == 0:
            return bigger
        bigger += 1
516376
def _at_least_x_are_true(a, b, x):
  """"""
  match = tf.equal(a, b)
  match = tf.cast(match, tf.int32)
  return tf.greater_equal(tf.reduce_sum(match), x)
919598
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
            else return o1.candidatePreferred.compareTo(o2.candidatePreferred);
        }
        return -1;
    }
429636
public static int ParetoObjectiveCompare(Solution solution1, Solution solution2)
   {
      boolean dominate1 = false;
      boolean dominate2 = false;

      int objective_count = solution1.getCosts().size();
      for (int i = 0; i < objective_count; i++)
      {
         if (solution1.getCost(i) < solution2.getCost(i))
         {
            dominate1 = true; // solution 2 is dominated

            if (dominate2)
            {
               return 0;
            }
         }
         else if (solution1.getCost(i) > solution2.getCost(i))
         {
            dominate2 = true; // solution 1 is dominated

            if (dominate1)
            {
               return 0;
            }
         }
      }

      if (dominate1 == dominate2)
      {
         return 0;
      }
      else if (dominate1)
      {
         return -1;
      }
      else
      {
         return 1;
      }
   }
936961
def compareValues(self, a, b):
        
        values = self.values()
        try:
            return cmp(values.index(a), values.index(b))
        except ValueError:
            return cmp(a, b)
1264857
public static <S extends Solution<?>> S getBestSolution(S solution1, S solution2, Comparator<S> comparator) {
    return getBestSolution(solution1, solution2, comparator, () -> JMetalRandom.getInstance().nextDouble());
  }
393761
static int compare (final Date nextFireTime1,
                        final int priority1,
                        final TriggerKey key1,
                        final Date nextFireTime2,
                        final int priority2,
                        final TriggerKey key2)
    {
      if (nextFireTime1 != null || nextFireTime2 != null)
      {
        if (nextFireTime1 == null)
          return 1;
        if (nextFireTime2 == null)
          return -1;
        if (nextFireTime1.before (nextFireTime2))
          return -1;
        if (nextFireTime1.after (nextFireTime2))
          return 1;
      }

      int comp = priority2 - priority1;
      if (comp == 0)
        comp = key1.compareTo (key2);
      return comp;
    }
684091
def eps_compare(f1, f2, eps):
    """"""
    res = f1 - f2
    if abs(res) <= eps:  # '<=',so eps == 0 works as expected
        return 0
    elif res < 0:
        return -1
    return 1
261489
public boolean needToCompare(S solution1, S solution2) {
    boolean needToCompare;
    double overall1, overall2;
    overall1 = Math.abs(numberOfViolatedConstraints.getAttribute(solution1) *
        overallConstraintViolation.getAttribute(solution1));
    overall2 = Math.abs(numberOfViolatedConstraints.getAttribute(solution2) *
        overallConstraintViolation.getAttribute(solution2));

    needToCompare = (overall1 > this.threshold) || (overall2 > this.threshold);

    return needToCompare;
  }
793348
def equal(self, line1, line2):
        '''
        
        '''

        eqLine = line1 == line2
        if eqLine:
            return BooleanPlus(True, False)
        else:
            unchanged_count = self.count_similar_words(line1, line2)
            similarity_percent = (
                (2.0 * unchanged_count) /
                (len(line1.split()) + len(line2.split()))
            )
            if similarity_percent >= 0.50:
                return BooleanPlus(True, True)
            return BooleanPlus(False, False)
793399
private int lrAligned(Area a1, Area a2)
    {
        if (a1.getX1() == a2.getX1())
            return (a1.getX2() == a2.getX2()) ? 2 : 1;
        else if (a1.getX2() == a2.getX2())
            return 1;
        else
            return 0;
    }
456202
def compare(ver1='', oper='==', ver2='', cmp_func=None, ignore_epoch=False):
    '''
    
    '''
    cmp_map = {'<': (-1,), '<=': (-1, 0), '==': (0,),
               '>=': (0, 1), '>': (1,)}
    if oper not in ('!=',) and oper not in cmp_map:
        log.error('Invalid operator \'%s\' for version comparison', oper)
        return False

    if cmp_func is None:
        cmp_func = version_cmp

    cmp_result = cmp_func(ver1, ver2, ignore_epoch=ignore_epoch)
    if cmp_result is None:
        return False

    # Check if integer/long
    if not isinstance(cmp_result, numbers.Integral):
        log.error('The version comparison function did not return an '
                  'integer/long.')
        return False

    if oper == '!=':
        return cmp_result not in cmp_map['==']
    else:
        # Gracefully handle cmp_result not in (-1, 0, 1).
        if cmp_result < -1:
            cmp_result = -1
        elif cmp_result > 1:
            cmp_result = 1

        return cmp_result in cmp_map[oper]
123597
public int compare(final SnomedConcept o1, final SnomedConcept o2) {
        if (o1 == o2) return 0;
        if (o1 != null) {
            if (o2 == null) return 1;
                // need to use BigInteger to compare SNOMED codes since some are fantastically long
            else return new BigInteger(o1.snomedId)
                    .compareTo(new BigInteger(o2.snomedId));
        }
        return -1;
    }