trait PartialOrder[A <: Data] extends Eq[A]
The PartialOrder
type class is used to define a partial ordering on some type A
.
A partial order is defined by a relation <=, which obeys the following laws:
- x <= x (reflexivity) - if x <= y and y <= x, then x === y (anti-symmetry) - if x <= y and y <= z, then x <= z (transitivity)
To compute both <= and >= at the same time, we use a Double number to encode the result of the comparisons x <= y and x >= y. The truth table is defined as follows:
x <= y x >= y Double true true = 0.0 (corresponds to x === y) false false = NaN (x and y cannot be compared) true false = -1.0 (corresponds to x < y) false true = 1.0 (corresponds to x > y)
- Self Type
- PartialOrder[A]
- Alphabetic
- By Inheritance
- PartialOrder
- Eq
- Any
- Hide All
- Show All
- Public
- Protected
Abstract Value Members
- abstract def getClass(): Class[_ <: AnyRef]
- Definition Classes
- Any
- abstract def partialCompare(x: A, y: A): ValidIO[ComparisonBundle]
Result of comparing
x
withy
.Result of comparing
x
withy
. Returns ValidIO[ComparisonBundle] withvalid
false if operands are not comparable. If operands are comparable,bits.lt
will be true ifx
<y
andbits.eq
will be true ifx
=y
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): Bool
Returns
true
ifx
andy
are equivalent,false
otherwise.Returns
true
ifx
andy
are equivalent,false
otherwise.- Definition Classes
- PartialOrder → Eq
- def gt(x: A, y: A): Bool
- def gteqv(x: A, y: A): Bool
- def hashCode(): Int
- Definition Classes
- Any
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def lt(x: A, y: A): Bool
- def lteqv(x: A, y: A): Bool
- def neqv(x: A, y: A): Bool
Returns
false
ifx
andy
are equivalent,true
otherwise.Returns
false
ifx
andy
are equivalent,true
otherwise.- Definition Classes
- Eq
- def on[B <: Data](f: (B) => A): PartialOrder[B]
Defines a partial order on
B
by mappingB
toA
usingf
and usingA
s order to orderB
.Defines a partial order on
B
by mappingB
toA
usingf
and usingA
s order to orderB
.- Definition Classes
- PartialOrder → Eq
- def pmax(x: A, y: A): ValidIO[A]
Returns Some(x) if x >= y, Some(y) if x < y, otherwise None.
- def pmin(x: A, y: A): ValidIO[A]
Returns Some(x) if x <= y, Some(y) if x > y, otherwise None.
- def reverse: PartialOrder[A]
Defines a partial order on
A
where all arrows switch direction. - def toString(): String
- Definition Classes
- Any