875d4988a3
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4937 542714f4-19e9-0310-aa3c-eee0fc999fb1
28 lines
532 B
ActionScript
28 lines
532 B
ActionScript
//
|
|
// $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);
|
|
}
|
|
}
|
|
}
|
|
}
|