trait Order[A] extends PartialOrder[A]
The Order type class is used to define a total ordering on some type A.
An order is defined by a relation <=, which obeys the following laws:
- either x <= y or y <= x (totality) - if x <= y and y <= x, then x == y (antisymmetry) - if x <= y and y <= z, then x <= z (transitivity)
The truth table for compare is defined as follows:
x <= y x >= y Int true true = 0 (corresponds to x == y) true false < 0 (corresponds to x < y) false true > 0 (corresponds to x > y)
By the totality law, x <= y and y <= x cannot be both false.
- Self Type
- Order[A]
- Alphabetic
- By Inheritance
- Order
- PartialOrder
- Eq
- Any
- Hide All
- Show All
- Public
- All
Abstract Value Members
Concrete Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
##(): Int
- Definition Classes
- Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
equals(arg0: Any): Boolean
- Definition Classes
- Any
-
def
eqv(x: A, y: A): Boolean
Returns
trueifxandyare equivalent,falseotherwise.Returns
trueifxandyare equivalent,falseotherwise.- Definition Classes
- Order → PartialOrder → Eq
-
def
gt(x: A, y: A): Boolean
- Definition Classes
- Order → PartialOrder
-
def
gteqv(x: A, y: A): Boolean
- Definition Classes
- Order → PartialOrder
-
def
hashCode(): Int
- Definition Classes
- Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
lt(x: A, y: A): Boolean
- Definition Classes
- Order → PartialOrder
-
def
lteqv(x: A, y: A): Boolean
- Definition Classes
- Order → PartialOrder
- def max(x: A, y: A): A
- def min(x: A, y: A): A
-
def
neqv(x: A, y: A): Boolean
Returns
falseifxandyare equivalent,trueotherwise.Returns
falseifxandyare equivalent,trueotherwise.- Definition Classes
- Eq
-
def
on[B](f: (B) ⇒ A): Order[B]
Defines an order on
Bby mappingBtoAusingfand usingAs order to orderB.Defines an order on
Bby mappingBtoAusingfand usingAs order to orderB.- Definition Classes
- Order → PartialOrder → Eq
-
def
partialCompare(x: A, y: A): Double
Result of comparing
xwithy.Result of comparing
xwithy. Returns NaN if operands are not comparable. If operands are comparable, returns a Double whose sign is: - negative iffx < y- zero iffx === y- positive iffx > y- Definition Classes
- Order → PartialOrder
-
def
pmax(x: A, y: A): Option[A]
Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.
Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.
- Definition Classes
- PartialOrder
-
def
pmin(x: A, y: A): Option[A]
Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.
Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.
- Definition Classes
- PartialOrder
-
def
reverse: Order[A]
Defines an ordering on
Awhere all arrows switch direction.Defines an ordering on
Awhere all arrows switch direction.- Definition Classes
- Order → PartialOrder
-
def
toString(): String
- Definition Classes
- Any
-
def
tryCompare(x: A, y: A): Option[Int]
Result of comparing
xwithy.Result of comparing
xwithy. Returns None if operands are not comparable. If operands are comparable, returns Some[Int] where the Int sign is: - negative iffx < y- zero iffx == y- positive iffx > y- Definition Classes
- PartialOrder