<commit_before>//
// $Id$

package com.threerings.util {

/**
 * Contains sorting Comparators.
 */
public class Comparators
{
    /**
     * A standard Comparator for comparing Comparable values.
     */
    public static function COMPARABLE (c1 :Comparable, c2 :Comparable) :int
    {
        if (c1 == c2) { // same object -or- both null
            return 0;
        } else if (c1 == null) {
            return -1;
        } else if (c2 == null) {
            return 1;
        } else {
            return c1.compareTo(c2);
        }
    }
}
}<commit_msg>Added createReverse(), and make comparators compatible with a flex Sort object.<commit_after>//
// $Id$

package com.threerings.util {

/**
 * Contains sorting Comparators.
 * These functions are suitable for passing to Array.sort(), or with a flex Sort object.
 */
public class Comparators
{
    /**
     * A standard Comparator for comparing Comparable values.
     */
    public static function COMPARABLE (c1 :Comparable, c2 :Comparable, ... ignored) :int
    {
        if (c1 == c2) { // same object -or- both null
            return 0;
        } else if (c1 == null) {
            return -1;
        } else if (c2 == null) {
            return 1;
        } else {
            return c1.compareTo(c2);
        }
    }

    /**
     * Create a Comparator function that reverses the ordering of the specified Comparator.
     */
    public static function createReverse (comparator :Function) :Function
    {
        return function (o1 :Object, o2 :Object, ... ignored) :int {
            return comparator(o2, o1); // simply reverse the ordering
        }
    }
}
}
{'fraction_non_alphanumeric': 0.11240786240786241, 'fraction_numerical': 0.01597051597051597, 'mean_word_length': 1.8934280639431615, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '400580', 'n_tokens_mistral': 489, 'n_tokens_neox': 478, 'n_words': 161}