scala

trait Ordering

[source: `scala/Ordering.scala`]

`trait` Ordering[T]
` extends `PartialOrdering[T]
A trait for representing total orderings. It is important to distinguish between a type that has a total order and a representation of total ordering on some type. This trait is for representing the latter. A total ordering is a binary relation on a type `T` that is also an equivalence relation and partial ordering on values of type `T`. This relation is exposed as the `compare` method of the `Ordering` trait. This relation must be:
• reflexive: `compare(x, x) == 0`, for any `x` of type `T`.
• symmetry: `compare(x, y) == z` and `compare(y, x) == w` then `Math.signum(z) == -Math.signum(w)`, for any `x` and `y` of type `T` and `z` and `w` of type `Int`.
• transitive: if `compare(x, y) == z` and `compare(y, w) == v` and `Math.signum(z) >= 0` and `Math.signum(v) >= 0` then `compare(x, w) == u` and `Math.signum(z + v) == Math.signum(u)`, for any `x`, `y`, and `w` of type `T` and `z`, `v`, and `u` of type `Int`.
Author
Geoffrey Washburn
Version
0.9.5, 2008-04-15
 Method Summary `abstract def` compare (x : T, y : T) : Int Returns a negative integer iff `x` comes before `y` in the ordering, returns 0 iff `x` is the same in the ordering as `y`, and returns a positive number iff `x` comes after `y` in the ordering. `override def` equiv (x : T, y : T) : Boolean Returns `true` iff `x` is equivalent to `y` in the ordering. `override def` gt (x : T, y : T) : Boolean Returns `true` iff `y` comes before `x` in the ordering and is not the same as `x`. `override def` gteq (x : T, y : T) : Boolean Returns `true` iff `y` comes before `x` in the ordering. `override def` lt (x : T, y : T) : Boolean Returns `true` iff `x` comes before `y` in the ordering and is not the same as `y`. `override def` lteq (x : T, y : T) : Boolean Returns `true` iff `x` comes before `y` in the ordering.
 Methods inherited from AnyRef getClass, hashCode, equals, clone, toString, notify, notifyAll, wait, wait, wait, finalize, ==, !=, eq, ne, synchronized
 Methods inherited from Any ==, !=, isInstanceOf, asInstanceOf
 Method Details
`abstract` `def` compare(x : T, y : T) : Int
Returns a negative integer iff `x` comes before `y` in the ordering, returns 0 iff `x` is the same in the ordering as `y`, and returns a positive number iff `x` comes after `y` in the ordering.

`override` `def` lteq(x : T, y : T) : Boolean
Returns `true` iff `x` comes before `y` in the ordering.
Overrides
PartialOrdering.lteq

`override` `def` gteq(x : T, y : T) : Boolean
Returns `true` iff `y` comes before `x` in the ordering.
Overrides
PartialOrdering.gteq

`override` `def` lt(x : T, y : T) : Boolean
Returns `true` iff `x` comes before `y` in the ordering and is not the same as `y`.
Overrides
PartialOrdering.lt

`override` `def` gt(x : T, y : T) : Boolean
Returns `true` iff `y` comes before `x` in the ordering and is not the same as `x`.
Overrides
PartialOrdering.gt

`override` `def` equiv(x : T, y : T) : Boolean
Returns `true` iff `x` is equivalent to `y` in the ordering.
Overrides
PartialOrdering.equiv