Scala Library: scala.math.PartialOrdering
scala.math.PartialOrdering
A trait for representing partial orderings. It is important to distinguish between a type that has a partial order and a representation of partial ordering on some type. This trait is for representing the latter.
A partial ordering is a binary
relation on a type T
, exposed as the lteq
method of this trait. This
relation must be:
- reflexive:
lteq(x, x) == true
, for anyx
of typeT
. - anti-symmetric: if
lteq(x, y) == true
andlteq(y, x) == true
thenequiv(x, y) == true
, for anyx
andy
of typeT
. - transitive: if
lteq(x, y) == true
andlteq(y, z) == true
thenlteq(x, z) == true
, for anyx
,y
, andz
of typeT
.
Additionally, a partial ordering induces an
equivalence relation on a
type T
: x
and y
of type T
are equivalent if and only if
lteq(x, y) && lteq(y, x) == true
. This equivalence relation is exposed as
the equiv
method, inherited from the Equiv trait.
- Self Type
- PartialOrdering [T]
- Source
- Version
- 1.0, 2008-04-0-3
- Since
- 2.7
Abstract Value Members From scala.math.PartialOrdering
abstract def lteq(x: T, y: T): Boolean
Returns true
iff x
comes before y
in the ordering.
(defined at scala.math.PartialOrdering)
abstract def tryCompare(x: T, y: T): Option[Int]
Result of comparing x
with operand y
. Returns None
if operands are not
comparable. If operands are comparable, returns Some(r)
where
r < 0
iffx < y
r == 0
iffx == y
r > 0
iffx > y
(defined at scala.math.PartialOrdering)
Concrete Value Members From scala.math.PartialOrdering
def equiv(x: T, y: T): Boolean
Returns true
iff x
is equivalent to y
in the ordering.
- Definition Classes
- PartialOrdering → Equiv
(defined at scala.math.PartialOrdering)
def gt(x: T, y: T): Boolean
Returns true
iff y
comes before x
in the ordering and is not the same as
x
.
(defined at scala.math.PartialOrdering)
def gteq(x: T, y: T): Boolean
Returns true
iff y
comes before x
in the ordering.
(defined at scala.math.PartialOrdering)
def lt(x: T, y: T): Boolean
Returns true
iff x
comes before y
in the ordering and is not the same as
y
.
(defined at scala.math.PartialOrdering)
def reverse: PartialOrdering[T]
(defined at scala.math.PartialOrdering)
Full Source:
Interested in Scala?
I send out weekly, personalized emails with articles and conference talks.
Subscribe now.