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.
Apartial ordering is a binary relation on a typeT, exposed as thelteq method of this trait. This relation must be:
- reflexive:lteq(x, x) ==true, for anyx of typeT. - anti-symmetric: iflteq(x, y) ==true andlteq(y, x) ==true thenequiv(x, y) ==true, for anyx andy of typeT. - transitive: iflteq(x, y) ==true andlteq(y, z) ==true thenlteq(x, z) ==true, for anyx,y, andz of typeT.
Additionally, a partial ordering induces anequivalence relation on a typeT:x andy of typeT are equivalent if and only iflteq(x, y) && lteq(y, x) ==true. This equivalence relation is exposed as theequiv method, inherited from theEquiv trait.
Returnstrue iffx comes beforey in the ordering.
Result of comparingx with operandy.
Result of comparingx with operandy. ReturnsNone if operands are not comparable. If operands are comparable, returnsSome(r) where -r < 0 iffx < y -r == 0 iffx == y -r > 0 iffx > y
Returnstrue iffx is equivalent toy in the ordering.
Returnstrue iffy comes beforex in the ordering and is not the same asx.
Returnstrue iffy comes beforex in the ordering and is not the same asx.
Returnstrue iffy comes beforex in the ordering.
Returnstrue iffx comes beforey in the ordering and is not the same asy.
Returnstrue iffx comes beforey in the ordering and is not the same asy.