PartialOrder<T> class abstract

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 result note
true true 0.0 (corresponds to x == y)
false false null (x and y cannot be compared)
true false -1.0 (corresponds to x < y)
false true 1.0 (corresponds to x > y)

Note: A partial order under which every pair of elements is comparable is called a total order (Order).

Inheritance
Implementers

Constructors

PartialOrder()
const

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

and(Eq<T> eq) Eq<T>
Return an Eq that gives the result of and of eq1 and eq2.
inherited
contramap<A>(T map(A)) PartialOrder<A>
Return an Eq instance based on a parameter of type T extracted from a class A.
override
eqv(T x, T y) bool
Returns true if x == y, false otherwise.
override
gt(T x, T y) bool
Returns true if x > y, false otherwise.
gteqv(T x, T y) bool
Returns true if x >= y, false otherwise.
lt(T x, T y) bool
Returns true if x < y, false otherwise.
lteqv(T x, T y) bool
Returns true if x <= y, false otherwise.
neqv(T x, T y) bool
Returns false if x and y are equivalent, true otherwise.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
or(Eq<T> eq) Eq<T>
Return an Eq that gives the result of or of this Eq and eq.
inherited
partialCompare(T x, T y) double?
Result of comparing x with y.
toString() String
A string representation of this object.
inherited
xor(Eq<T> eq) Eq<T>
Return an Eq that gives the result of xor of this Eq and eq.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

by<A, B>(B f(A a), PartialOrder<B> po) PartialOrder<A>
Convert an implicit PartialOrder[B] to an PartialOrder[A] using the given function f.
override
from<A>(double? f(A a1, A a2)) PartialOrder<A>
Define a PartialOrder[A] using the given function f.
reverse<A>(PartialOrder<A> p) PartialOrder<A>
Defines a partial order on A from p where all arrows switch direction.