blob: 4eeab101f09ef3cedff1756eea1bde22376cf6ac (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
/* __ *\
** ________ ___ / / ___ Scala API **
** / __/ __// _ | / / / _ | (c) 2003-2006, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
\* */
// $Id$
package scala
/** A class for totally ordered data.
*
* Note that since version 2006-07-24 this class is no longer covariant in a.
*
* @author Martin Odersky
* @version 1.1, 2006-07-24
*/
trait Ordered[a] {
/** Result of comparing <code>this</code> with operand <code>that</code>.
* returns <code>x</code> where
* <code>x < 0</code> iff <code>this < that</code>
* <code>x == 0</code> iff <code>this == that</code>
* <code>x > 0</code> iff <code>this > that</code>
*/
def compare(that: a): Int
def < (that: a): Boolean = (this compare that) < 0
def > (that: a): Boolean = (this compare that) > 0
def <= (that: a): Boolean = (this compare that) <= 0
def >= (that: a): Boolean = (this compare that) >= 0
def compareTo(that: a): Int = compare(that)
}
|